From: Nishanth Aravamudan <nacc@us.ibm.com>
To: janitor@sternwelten.at, akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 4/4] char/snsc: reorder set_current_state() and add_wait_queue()
Date: Mon, 22 Nov 2004 13:41:07 -0800 [thread overview]
Message-ID: <20041122214107.GD7770@us.ibm.com> (raw)
In-Reply-To: <20041122205620.GA5806@admingilde.org>
On Mon, Nov 22, 2004 at 09:56:20PM +0100, Martin Waitz wrote:
> hoi :)
>
> On Sat, Nov 20, 2004 at 03:47:03AM +0100, janitor@sternwelten.at wrote:
> > Description: Reorder add_wait_queue() and set_current_state() as a
> > signal could be lost in between the two functions.
>
> couldn't you loose a wake event that way?
The patch in question was made specifically because the given code may
miss wake events. Hence the reorder and my description. Since I'm not an
expert on locking, I asked Oliver Neukum about this exact issue a while
ago. Here is his response:
--------
>Am Mittwoch, 15. September 2004 19:34 schrieb Nishanth Aravamudan:
> Oliver,
>
> It was recommended to me to ask you a question about the proper ordering
> of add_wait_queue() and set_current_state().
>
> In some drivers the order is
>
> set_current_state(TASK_INTERRUPTIBLE);
> add_wait_queue(...);
That is correct.
> and in others it is
>
> add_wait_queue(...);
Here in between is a window in which a wake up would be missed.
> set_current_state(TASK_INTERRUPTIBLE);
>
> It seems like one of these should be oorrect and not the other, but I'm
> not sure which is which. Any insight you could provide would be greatly
> appreciated.
Iff you test whether you should indeed sleep before you call schedule,
it doesn't matter. In the other case, you need to use the first form.
-------
Hope that clears things up a bit.
-Nish
prev parent reply other threads:[~2004-11-23 5:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-20 2:47 [patch 4/4] char/snsc: reorder set_current_state() and add_wait_queue() janitor
2004-11-22 20:56 ` Martin Waitz
2004-11-22 21:41 ` Nishanth Aravamudan [this message]
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=20041122214107.GD7770@us.ibm.com \
--to=nacc@us.ibm.com \
--cc=akpm@osdl.org \
--cc=janitor@sternwelten.at \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox