[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090122083457.GC7438@elte.hu>
Date: Thu, 22 Jan 2009 09:34:57 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Mandeep Singh Baines <msb@...gle.com>
Cc: fweisbec@...il.com, linux-kernel@...r.kernel.org,
rientjes@...gle.com, mbligh@...gle.com, thockin@...gle.com
Subject: Re: [PATCH v2] softlockup: remove hung_task_check_count
* Mandeep Singh Baines <msb@...gle.com> wrote:
> > do the need_resched() check first (it's very lighweight) - and thus
> > only do the heavy ops (get-task-struct & tasklist_lock unlock) if that
> > is set?
>
> Wanted to upper-bound the amount of time the lock is held. In order to
> give others a chance to write_lock the tasklist, released the lock
> regardless of whether a re-schedule is need.
but this:
> +static void check_hung_reschedule(struct task_struct *t)
> +{
> + get_task_struct(t);
> + read_unlock(&tasklist_lock);
> + if (need_resched())
> + schedule();
> + read_lock(&tasklist_lock);
> + put_task_struct(t);
> +}
does not actually achieve that. Releasing a lock does not mean that other
CPUs will immediately be able to get it - if the ex-owner quickly
re-acquires it then it will often succeed in doing so. Perhaps adding a
cpu_relax() would increase the chance ... but still, it looks a bit weird.
Ingo
--
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