From: David Howells <dhowells@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: dhowells@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
David Miller <davem@davemloft.net>,
Serge Hallyn <serue@us.ibm.com>,
Steve Dickson <steved@redhat.com>,
Trond Myklebust <Trond.Myklebust@netapp.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Daire Byrne <Daire.Byrne@framestore.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] slow_work_execute() needs mb() before test_bit(SLOW_WORK_PENDING)
Date: Mon, 13 Apr 2009 22:47:46 +0100 [thread overview]
Message-ID: <32305.1239659266@redhat.com> (raw)
In-Reply-To: <20090413201348.GA16661@redhat.com>
Oleg Nesterov <oleg@redhat.com> wrote:
> clear_bit_unlock() implies release semantics, iow we have a one-way barrier
> before clear_bit().
That is correct. The stuff before the clear_bit_unlock() must not leak out
past it. SLOW_WORK_EXECUTING is a lock around the execution of the work item.
> But we need the mb() semantics after clear_bit(), before we test
> SLOW_WORK_PENDING. Otherwise we can miss SLOW_WORK_ENQ_DEFERRED if we race
> slow_work_enqueue().
But if you move the mb() to the other side, and reduce to clear_bit() you
break the above non-reentrancy guarantee.
> However, given that both clear_bit() and set_bit() use the same word,
> perhaps this is not possible.
I would assume clear_bit() and set_bit() on different bits of the same word
must interact as if they're on the same bit, with regard to atomiticity, but I
don't know for certain that it is guaranteed.
> But in that case I don't understand why do we need clear_bit_unlock(), not
> just clear_bit(), and how "mb is not needeed" could be derived from
> documentation.
As mentioned above, SLOW_WORK_EXECUTING is a lock against multiple entrance to
the execution function.
Perhaps I should amend the comments to make this clearer.
David
next prev parent reply other threads:[~2009-04-13 21:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-13 20:13 [PATCH] slow_work_execute() needs mb() before test_bit(SLOW_WORK_PENDING) Oleg Nesterov
2009-04-13 20:13 ` Oleg Nesterov
2009-04-13 21:47 ` David Howells [this message]
2009-04-13 22:02 ` Oleg Nesterov
2009-04-16 9:43 ` David Howells
2009-04-16 14:15 ` Oleg Nesterov
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=32305.1239659266@redhat.com \
--to=dhowells@redhat.com \
--cc=Daire.Byrne@framestore.com \
--cc=Trond.Myklebust@netapp.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=serue@us.ibm.com \
--cc=steved@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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.