Subject: + memcg-mm_update_next_owner-should-skip-kthreads.patch added to -mm tree To: oleg@xxxxxxxxxx,bsingharora@xxxxxxxxx,hannes@xxxxxxxxxxx,kamezawa.hiroyu@xxxxxxxxxxxxxx,mhocko@xxxxxxx,pchiang@xxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Mon, 28 Apr 2014 15:58:05 -0700 The patch titled Subject: memcg: mm_update_next_owner() should skip kthreads has been added to the -mm tree. Its filename is memcg-mm_update_next_owner-should-skip-kthreads.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/memcg-mm_update_next_owner-should-skip-kthreads.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/memcg-mm_update_next_owner-should-skip-kthreads.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: Oleg Nesterov <oleg@xxxxxxxxxx> Subject: memcg: mm_update_next_owner() should skip kthreads "Search through everything else" in mm_update_next_owner() can hit a kthread which adopted this "mm" via use_mm(), it should not be used as mm->owner. Add the PF_KTHREAD check. While at it, change this code to use for_each_process_thread() instead of deprecated do_each_thread/while_each_thread. Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx> Reviewed-by: Michal Hocko <mhocko@xxxxxxx> Cc: Balbir Singh <bsingharora@xxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Cc: Peter Chiang <pchiang@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/exit.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff -puN kernel/exit.c~memcg-mm_update_next_owner-should-skip-kthreads kernel/exit.c --- a/kernel/exit.c~memcg-mm_update_next_owner-should-skip-kthreads +++ a/kernel/exit.c @@ -395,14 +395,12 @@ retry: } /* - * Search through everything else. We should not get - * here often + * Search through everything else, we should not get here often. */ - do_each_thread(g, c) { - if (c->mm == mm) + for_each_process_thread(g, c) { + if (!(c->flags & PF_KTHREAD) && c->mm == mm) goto assign_new_owner; - } while_each_thread(g, c); - + } read_unlock(&tasklist_lock); /* * We found no owner yet mm_users > 1: this implies that we are _ Patches currently in -mm which might be from oleg@xxxxxxxxxx are nmi-provide-the-option-to-issue-an-nmi-back-trace-to-every-cpu-but-current.patch kernel-watchdogc-print-traces-for-all-cpus-on-lockup-detection.patch kernel-watchdogc-print-traces-for-all-cpus-on-lockup-detection-fix.patch mmvmacache-optimize-overflow-system-wide-flushing.patch memcg-kill-config_mm_owner.patch memcg-mm_update_next_owner-should-skip-kthreads.patch memcg-optimize-the-search-everything-else-loop-in-mm_update_next_owner.patch memcg-kill-start_kernel-mm_init_ownerinit_mm.patch sys_sgetmask-sys_ssetmask-add-config_sgetmask_syscall.patch kthreads-kill-clone_kernel-change-kernel_threadkernel_init-to-avoid-clone_sighand.patch signals-kill-sigfindinword.patch signals-s-siginitset-sigemptyset-in-do_sigtimedwait.patch signals-kill-rm_from_queue-change-prepare_signal-to-use-for_each_thread.patch signals-rename-rm_from_queue_full-to-flush_sigqueue_mask.patch signals-cleanup-the-usage-of-t-current-in-do_sigaction.patch signals-mv-disallow_signal-from-schedh-exitc-to-signal.patch signals-jffs2-fix-the-wrong-usage-of-disallow_signal.patch signals-kill-the-obsolete-sigdelset-and-recalc_sigpending-in-allow_signal.patch signals-disallow_signal-should-flush-the-potentially-pending-signal.patch signals-introduce-kernel_sigaction.patch signals-change-wait_for_helper-to-use-kernel_sigaction.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