[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090205184003.GB10819@google.com>
Date: Thu, 5 Feb 2009 10:40:03 -0800
From: Mandeep Singh Baines <msb@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Ingo Molnar <mingo@...e.hu>,
Frédéric Weisbecker <fweisbec@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org, rientjes@...gle.com,
mbligh@...gle.com, thockin@...gle.com
Subject: Re: [PATCH 2/2 v4] softlockup: check all tasks in hung_task
Andrew Morton (akpm@...ux-foundation.org) wrote:
> On Thu, 5 Feb 2009 15:34:53 +0100 Ingo Molnar <mingo@...e.hu> wrote:
>
> >
> > Subject: [PATCH] softlockup: check all tasks in hung_task
> >
> > Impact: extend the scope of hung-task checks
> >
>
> A nanonit:
>
> > +static const int hung_task_batching = 1024;
>
> static const definitions look pretty but they're a bit misleading.
>
> > static void check_hung_uninterruptible_tasks(unsigned long timeout)
> > {
> > + int batch_count = hung_task_batching;
> > int max_count = sysctl_hung_task_check_count;
> > unsigned long now = get_timestamp();
> > struct task_struct *g, *t;
> > @@ -131,6 +159,13 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
> > do_each_thread(g, t) {
> > if (!--max_count)
> > goto unlock;
> > + if (!--batch_count) {
> > + batch_count = hung_task_batching;
> > + rcu_lock_break(g, t);
> > + /* Exit if t or g was unhashed during refresh. */
> > + if (t->state == TASK_DEAD || g->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);
>
> The reader of this area of the code will expect that hung_task_batching
> is a variable. It _looks_ like the value of that variable can be altered
> at any time by some other thread. It _looks_ like this code will explode
> if someone has accidentally set hung_task_batching to zero, etc.
>
The code would not break if hung_task_batching was exported out as a sysctl.
If hung_task_batching is set to zero at any time, the behavior will be
to process all tasks in one batch. This seems like a reasonable behavior
for the zero case. It is also consistent with the behavior of
sysctl_hung_task_check_count.
Maybe a comment should be added by the declaration of both variables explaining
the zero behavior?
> But none of that is actually true, because hung_task_batching is, surprisingly,
> a compile-time constant.
>
> All this misleadingness would be fixed if it were called
> HUNG_TASK_BATCHING. But then it wouldn't be pretty.
>
--
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