Skip to contentSkip to conversation

+ memcg-mm_update_next_owner-should-skip-kthreads.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Apr 28, 2014

lore
Share & tools
lore
#0 lore raw

Subject: + memcg-mm_update_next_owner-should-skip-kthreads.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
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 <[email protected]>
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.

Cc Balbir Singh <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc KAMEZAWA Hiroyuki <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Peter Chiang <[email protected]>

---

 kernel/exit.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
kernel/exit.c renamed from kernel/exit.c~memcg-mm_update_next_owner-should-skip-kthreads +4 -6
diff -puN kernel/exit.c~memcg-mm_update_next_owner-should-skip-kthreads 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 [email protected] 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