All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: mingo@kernel.org, oleg@redhat.com, torvalds@linux-foundation.org
Cc: tglx@linutronix.de, ilya.dryomov@inktank.com,
	umgwanakikbuti@gmail.com, linux-kernel@vger.kernel.org,
	Eric Paris <eparis@parisplace.org>,
	John McCutchan <john@johnmccutchan.com>,
	Robert Love <rlove@rlove.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>
Subject: Re: [RFC][PATCH 1/7] wait: Provide infrastructure to deal with nested blocking
Date: Mon, 4 Aug 2014 15:44:55 +0200	[thread overview]
Message-ID: <20140804134455.GT19379@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140804103537.356311360@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

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().

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-08-04 13:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 10:30 [RFC][PATCH 0/7] nested sleeps, fixes and debug infra Peter Zijlstra
2014-08-04 10:30 ` [RFC][PATCH 1/7] wait: Provide infrastructure to deal with nested blocking Peter Zijlstra
2014-08-04 13:44   ` Peter Zijlstra [this message]
2014-08-04 18:35     ` Oleg Nesterov
2014-08-04 10:30 ` [RFC][PATCH 2/7] wait: Provide Peter Zijlstra
2014-08-04 10:30 ` [RFC][PATCH 3/7] exit: Desl with nested sleeps Peter Zijlstra
2014-08-04 18:53   ` Oleg Nesterov
2014-08-04 10:30 ` [RFC][PATCH 4/7] inotify: Deal " Peter Zijlstra
2014-08-04 19:23   ` Oleg Nesterov
2014-08-04 21:02     ` Peter Zijlstra
2014-08-05  2:22   ` Lai Jiangshan
2014-08-05  7:28     ` Peter Zijlstra
2014-08-04 10:30 ` [RFC][PATCH 5/7] tty: " Peter Zijlstra
2014-08-05 23:29   ` Greg Kroah-Hartman
2014-08-04 10:30 ` [RFC][PATCH 6/7] smp: Correctly deal " Peter Zijlstra
2014-08-04 10:30 ` [RFC][PATCH 7/7] sched: Debug " Peter Zijlstra
2014-08-05  8:33 ` [RFC][PATCH 0/7] nested sleeps, fixes and debug infra Ilya Dryomov
2014-08-05  8:33   ` Ilya Dryomov
2014-08-05 13:06   ` Peter Zijlstra
2014-08-06  7:51     ` Ilya Dryomov
2014-08-06  7:51       ` Ilya Dryomov
2014-08-06  8:31       ` Peter Zijlstra
2014-08-06 21:16         ` David Miller
2014-08-06 21:16           ` David Miller
2014-08-07  8:10           ` Peter Zijlstra

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=20140804134455.GT19379@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=eparis@parisplace.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilya.dryomov@inktank.com \
    --cc=john@johnmccutchan.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rlove@rlove.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=umgwanakikbuti@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.