Subject: + mm-oom-prefer-thread-group-leaders-for-display-purposes.patch added to -mm tree To: rientjes@xxxxxxxxxx,hannes@xxxxxxxxxxx,kamezawa.hiroyu@xxxxxxxxxxxxxx,mhocko@xxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Tue, 21 Jan 2014 11:26:07 -0800 The patch titled Subject: mm, oom: prefer thread group leaders for display purposes has been added to the -mm tree. Its filename is mm-oom-prefer-thread-group-leaders-for-display-purposes.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-oom-prefer-thread-group-leaders-for-display-purposes.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-oom-prefer-thread-group-leaders-for-display-purposes.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: David Rientjes <rientjes@xxxxxxxxxx> Subject: mm, oom: prefer thread group leaders for display purposes When two threads have the same badness score, it's preferable to kill the thread group leader so that the actual process name is printed to the kernel log rather than the thread group name which may be shared amongst several processes. This was the behavior when select_bad_process() used to do for_each_process(), but it now iterates threads instead and leads to ambiguity. Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 19 ++++++++++++------- mm/oom_kill.c | 12 ++++++++---- 2 files changed, 20 insertions(+), 11 deletions(-) diff -puN mm/memcontrol.c~mm-oom-prefer-thread-group-leaders-for-display-purposes mm/memcontrol.c --- a/mm/memcontrol.c~mm-oom-prefer-thread-group-leaders-for-display-purposes +++ a/mm/memcontrol.c @@ -1800,13 +1800,18 @@ static void mem_cgroup_out_of_memory(str break; }; points = oom_badness(task, memcg, NULL, totalpages); - if (points > chosen_points) { - if (chosen) - put_task_struct(chosen); - chosen = task; - chosen_points = points; - get_task_struct(chosen); - } + if (points < chosen_points) + continue; + /* Prefer thread group leaders for display purposes */ + if (points == chosen_points && + thread_group_leader(chosen)) + continue; + + if (chosen) + put_task_struct(chosen); + chosen = task; + chosen_points = points; + get_task_struct(chosen); } css_task_iter_end(&it); } diff -puN mm/oom_kill.c~mm-oom-prefer-thread-group-leaders-for-display-purposes mm/oom_kill.c --- a/mm/oom_kill.c~mm-oom-prefer-thread-group-leaders-for-display-purposes +++ a/mm/oom_kill.c @@ -327,10 +327,14 @@ static struct task_struct *select_bad_pr break; }; points = oom_badness(p, NULL, nodemask, totalpages); - if (points > chosen_points) { - chosen = p; - chosen_points = points; - } + if (points < chosen_points) + continue; + /* Prefer thread group leaders for display purposes */ + if (points == chosen_points && thread_group_leader(chosen)) + continue; + + chosen = p; + chosen_points = points; } if (chosen) get_task_struct(chosen); _ Patches currently in -mm which might be from rientjes@xxxxxxxxxx are origin.patch mm-remove-bug_on-from-mlock_vma_page.patch arch-x86-mm-sratc-skip-numa_no_node-while-parsing-slit.patch arch-x86-mm-sratc-skip-numa_no_node-while-parsing-slit-fix.patch mm-make-setpage_address-static-inline-if-want_page_virtual.patch mm-mempolicy-remove-unneeded-functions-for-uma-configs.patch mm-show_mem-remove-show_mem_filter_page_count.patch mm-show_mem-remove-show_mem_filter_page_count-fix.patch introduce-for_each_thread-to-replace-the-buggy-while_each_thread.patch oom_kill-change-oom_killc-to-use-for_each_thread.patch oom_kill-has_intersects_mems_allowed-needs-rcu_read_lock.patch oom_kill-add-rcu_read_lock-into-find_lock_task_mm.patch mm-page_alloc-allow-__gfp_nofail-to-allocate-below-watermarks-after-reclaim.patch x86-mm-memblock-switch-to-use-numa_no_node.patch lib-show_memc-show-num_poisoned_pages-when-oom.patch memcg-oom-lock-mem_cgroup_print_oom_info.patch mm-page_alloc-warn-for-non-blockable-__gfp_nofail-allocation-failure.patch fs-proc-pagec-add-pageanon-check-to-surely-detect-thp.patch mm-prevent-setting-of-a-value-less-than-0-to-min_free_kbytes.patch memcg-do-not-hang-on-oom-when-killed-by-userspace-oom-access-to-memory-reserves.patch mm-nobootmem-free_all_bootmem-again-fix.patch mm-nobootmem-free_all_bootmem-again-fix-fix.patch mm-show-message-when-updating-min_free_kbytes-in-thp.patch mm-oom-prefer-thread-group-leaders-for-display-purposes.patch checkpatch-add-warning-of-future-__gfp_nofail-use.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html