[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090127032359.GA17359@redhat.com>
Date: Tue, 27 Jan 2009 04:23:59 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Chris Mason <chris.mason@...cle.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Matthew Wilcox <matthew@....cx>,
Chuck Lever <cel@...i.umich.edu>,
Nick Piggin <nickpiggin@...oo.com.au>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Ingo Molnar <mingo@...e.hu>
Subject: Re: [RFC v5] wait: prevent exclusive waiter starvation
On 01/26, Johannes Weiner wrote:
>
> Another iteration. I didn't use a general finish_wait_exclusive() but
> a version of this function that just returns whether we were woken
> through the queue or not.
But if your helper (finish_wait_woken) returns true, we always need
to wakeup the next waiter, or we don't need to use it. So why not
place the wakeup in the helper itself?
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -333,16 +333,20 @@ do { \
> for (;;) { \
> prepare_to_wait_exclusive(&wq, &__wait, \
> TASK_INTERRUPTIBLE); \
> - if (condition) \
> + if (condition) { \
> + finish_wait(&wq, &__wait); \
> break; \
> + } \
> if (!signal_pending(current)) { \
> schedule(); \
> continue; \
> } \
> ret = -ERESTARTSYS; \
> + if (finish_wait_woken(&wq, &__wait)) \
> + __wake_up_common(&wq, TASK_INTERRUPTIBLE, \
No, we can't use __wake_up_common() without wq->lock.
Oleg.
--
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