public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mandeep Singh Baines <msb@google.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: fweisbec@gmail.com, linux-kernel@vger.kernel.org,
	rientjes@google.com, mbligh@google.com, thockin@google.com
Subject: Re: [PATCH v3] softlockup: remove hung_task_check_count
Date: Fri, 23 Jan 2009 18:56:18 -0800	[thread overview]
Message-ID: <20090124025618.GB31189@google.com> (raw)
In-Reply-To: <20090123092306.GB29820@elte.hu>

Ingo Molnar (mingo@elte.hu) wrote:
> 
> not sure i like the whole idea of removing the max iterations check. In 
> theory if there's a _ton_ of tasks, we could spend a lot of time looping 
> there. So it always looked prudent to limit it somewhat.
> 

We could go back to exporting max iterations to proc, and set the nice
value higher.

Or:

Instead of searching the tasklist from the beginning every time, continue
where you left off. On loaded systems, will take a while to search the
entire list but at least all tasks will be checked.

Something like this:

diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index ba8ccd4..d220796 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -109,6 +109,15 @@ static void check_hung_task(struct task_struct *t, unsigned long now,
 		panic("hung_task: blocked tasks");
 }
 
+static void wait_till_next_iteration(struct task_struct *t)
+{
+	get_task_state(t);
+	read_unlock(&tasklist_lock);
+	schedule_timeout_interruptible(hung_task_poll_jiffies);
+	read_lock(&tasklist_lock);
+	put_task_state(t);
+}
+
 /*
  * Check whether a TASK_UNINTERRUPTIBLE does not get woken up for
  * a really long time (120 seconds). If that happens, print out
@@ -129,8 +138,14 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
 
 	read_lock(&tasklist_lock);
 	do_each_thread(g, t) {
-		if (!--max_count)
-			goto unlock;
+		if (!--max_count) {
+			max_count = HUNG_TASK_CHECK_COUNT;
+			wait_till_next_iteration(t);
+			timeout = sysctl_hung_task_timeout_secs;
+			/* Exit loop if t was unlinked or timeout set to 0. */
+			if (!timeout || t->state == TASK_DEAD)
+				goto unlock;
+		}
 		/* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */
 		if (t->state == TASK_UNINTERRUPTIBLE)
 			check_hung_task(t, now, timeout);

      parent reply	other threads:[~2009-01-24  2:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21  1:46 [PATCH] softlockup: remove hung_task_check_count Mandeep Singh Baines
2009-01-21 11:13 ` Ingo Molnar
2009-01-21 13:14   ` Frédéric Weisbecker
2009-01-22  0:54   ` [PATCH v2] " Mandeep Singh Baines
2009-01-22  8:34     ` Ingo Molnar
2009-01-22 19:55       ` [PATCH v3] " Mandeep Singh Baines
2009-01-23  3:21         ` Mandeep Baines
2009-01-23  9:23           ` Ingo Molnar
2009-01-23 10:04             ` Frédéric Weisbecker
2009-01-24  1:55               ` Mandeep Singh Baines
2009-01-24 15:52                 ` Frederic Weisbecker
2009-01-26  2:25                   ` Mandeep Baines
2009-01-24  2:56             ` Mandeep Singh Baines [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090124025618.GB31189@google.com \
    --to=msb@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@google.com \
    --cc=mingo@elte.hu \
    --cc=rientjes@google.com \
    --cc=thockin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox