[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140804134455.GT19379@twins.programming.kicks-ass.net>
Date: Mon, 4 Aug 2014 15:44:55 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: mingo@...nel.org, oleg@...hat.com, torvalds@...ux-foundation.org
Cc: tglx@...utronix.de, ilya.dryomov@...tank.com,
umgwanakikbuti@...il.com, linux-kernel@...r.kernel.org,
Eric Paris <eparis@...isplace.org>,
John McCutchan <john@...nmccutchan.com>,
Robert Love <rlove@...ve.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.cz>
Subject: Re: [RFC][PATCH 1/7] wait: Provide infrastructure to deal with
nested blocking
On Mon, Aug 04, 2014 at 12:30:26PM +0200, Peter Zijlstra wrote:
> +long wait_woken(wait_queue_t *wait, unsigned mode, long timeout)
> +{
> + set_current_state(mode);
> + if (!(wait->flags & WQ_FLAG_WOKEN))
> + timeout = schedule_timeout(timeout);
> + else
> + wait->flags &= ~WQ_FLAG_WOKEN;
I just noticed that poll_schedule_timeout() uses set_mb() for clearing
its triggered variable. But I'm not entirely sure I see why..
> + __set_current_state(TASK_RUNNING);
> +
> + return timeout;
> +}
> +EXPORT_SYMBOL(wait_woken);
> +
> +int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
> +{
> + /*
> + * Although this function is called under waitqueue lock, LOCK
> + * doesn't imply write barrier and the users expect write
> + * barrier semantics on wakeup functions. The following
> + * smp_wmb() is equivalent to smp_wmb() in try_to_wake_up()
> + * and is paired with set_mb() in wait_woken().
> + */
> + smp_wmb();
> + wait->flags |= WQ_FLAG_WOKEN;
> +
> + return default_wake_function(wait, mode, sync, key);
> +}
> +EXPORT_SYMBOL(woken_wake_function);
So possibly we could also use this for poll_schedule_timeout() and
__pollwake().
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists