From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Hugh Dickins <hugh@veritas.com>,
Paul Mackerras <paulus@samba.org>,
Anton Blanchard <anton@samba.org>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
Andrea Arcangeli <andrea@suse.de>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Possible memory ordering bug in page reclaim?
Date: Sat, 15 Oct 2005 18:59:34 +1000 [thread overview]
Message-ID: <4350C4F6.4030807@yahoo.com.au> (raw)
In-Reply-To: <1129362196.7620.8.camel@gaston>
Benjamin Herrenschmidt wrote:
> On Sat, 2005-10-15 at 07:17 +0100, Hugh Dickins wrote:
>
>>On Sat, 15 Oct 2005, Nick Piggin wrote:
>>
>>>1 2
>>>find_get_page();
>>>write to page write_lock(tree_lock);
>>>SetPageDirty(); if (page_count != 2
>>>put_page(); || PageDirty())
>>>
>>>Now I'm worried that 2 might see PageDirty *before* SetPageDirty in
>>
>> page->flags
>>
>>>1, and page_count *after* put_page in 1.
>>
>>I think you're right. But I'm the last person to ask
>>barrier/ordering questions of. CC'ed Ben and Andrea.
>
>
> yup, now the question is wether PG_Dirty will be visible to CPU 2 before
> the page count is decremented right ? That depends on put_page, I
> suppose. If it's doing a simple atomic, there is an issue. But atomics
> with return has been so often abused as locks that they may have been
> implemented with a barrier... (On ppc64, it will do an eieio, thus I
> think it should be ok).
>
Well yes, that's on the store side (1, above). However can't a CPU
still speculatively (eg. guess the branch) load the page->flags
cacheline which might be satisfied from memory before the page->count
cacheline loads? Ie. you can still have the correct write ordering
but have incorrect read ordering?
Because neither PageDirty nor page_count is a barrier, and there is
no read barrier between them.
Nick
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
next prev parent reply other threads:[~2005-10-15 8:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-15 3:28 Possible memory ordering bug in page reclaim? Nick Piggin
2005-10-15 6:17 ` Hugh Dickins
2005-10-15 7:43 ` Benjamin Herrenschmidt
2005-10-15 8:00 ` Herbert Xu
2005-10-15 16:57 ` Linus Torvalds
2005-10-15 19:29 ` David S. Miller
2005-10-15 22:17 ` Benjamin Herrenschmidt
2005-10-16 0:04 ` Nick Piggin
2005-10-15 8:59 ` Nick Piggin [this message]
2005-10-15 12:08 ` Herbert Xu
2005-10-15 13:35 ` Nick Piggin
2005-10-15 18:00 ` Andrea Arcangeli
2005-10-15 19:48 ` Herbert Xu
2005-10-15 20:07 ` Andrea Arcangeli
2005-10-15 23:07 ` David S. Miller
2005-10-16 19:36 ` Ivan Kokshaysky
2005-10-17 4:29 ` David S. Miller
2005-10-17 7:23 ` Ivan Kokshaysky
2005-10-17 11:28 ` Andrea Arcangeli
2005-10-15 22:16 ` Benjamin Herrenschmidt
2005-10-15 23:13 ` David S. Miller
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=4350C4F6.4030807@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=torvalds@osdl.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