lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150317192521.GB32579@redhat.com>
Date:	Tue, 17 Mar 2015 20:25:21 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Aaron Tomlin <atomlin@...hat.com>
Cc:	akpm@...ux-foundation.org, rientjes@...gle.com,
	dwysocha@...hat.com, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...nel.org>
Subject: [PATCH 1/2] hung_task: split for_each_process_thread() into
	for_each_process() + __for_each_thread()

Preparation. Change the main loop in check_hung_uninterruptible_tasks()
to use the nested for_each_process() + __for_each_thread() loops explicitly.
Note that we use __for_each_thread(), not for_each_thread(). This way it
is clear that the inner loop doesn't depend on 'g' after we read ->signal.

Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---
 kernel/hung_task.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index e0f90c2..4735b99 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -169,17 +169,22 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
 		return;
 
 	rcu_read_lock();
-	for_each_process_thread(g, t) {
-		if (!max_count--)
-			goto unlock;
-		if (!--batch_count) {
-			batch_count = HUNG_TASK_BATCHING;
-			if (!rcu_lock_break(g, t))
+	for_each_process(g) {
+		struct signal_struct *sig = g->signal;
+
+		__for_each_thread(sig, t) {
+			if (!max_count--)
 				goto unlock;
+
+			if (!--batch_count) {
+				batch_count = HUNG_TASK_BATCHING;
+				if (!rcu_lock_break(g, t))
+					goto unlock;
+			}
+			/* use "==" to skip the TASK_KILLABLE tasks */
+			if (t->state == TASK_UNINTERRUPTIBLE)
+				check_hung_task(t, timeout);
 		}
-		/* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */
-		if (t->state == TASK_UNINTERRUPTIBLE)
-			check_hung_task(t, timeout);
 	}
  unlock:
 	rcu_read_unlock();
-- 
1.5.5.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ