LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch 3/3] mm: fix PageUptodate memorder
Date: Mon, 26 Feb 2007 03:37:12 +0100	[thread overview]
Message-ID: <20070226023712.GA23985@wotan.suse.de> (raw)
In-Reply-To: <20070225040657.eb4fc159.akpm@linux-foundation.org>

On Sun, Feb 25, 2007 at 04:06:57AM -0800, Andrew Morton wrote:
> 
> What an unpleasing patchset.  I really really hope we really have a bug in
> there, and that all this crap isn't pointless uglification.

It's the same bug for file pages as we had for anonymous pages, which
the POWER guys actually hit. Do you disagree? I like this patch much
better than the smp_wmb that we currently do just for anon pages.

> We _do_ need a flush_dcaceh_page() in all cases which you're concerned
> about.  Perhaps we should stick the appropriate barriers in there.

I think the memorder problem is conceptually a page data vs PG_uptodate
one, because the read-side assumes that the data will be initialised before
PG_uptodate is set.

After the page is uptodate, you don't need subsequent barriers (that you
would get via flush_dcache_page), because we've never really tried to
impose any synchronisation on parallel read vs write.

A memory barrier in flush_dcache_page would do the trick as well, I think,
but it is not really any better. It is misleading because it is not the
canonical fix. And we'd still need the smp_rmb in the PageUptodate read-side.

> > On Thu, 15 Feb 2007 08:31:31 +0100 (CET) Nick Piggin <npiggin@suse.de> wrote:
> > +static inline void SetNewPageUptodate(struct page *page)
> > +{
> > +	/*
> > +	 * S390 sets page dirty bit on IO operations, which is why it is
> > +	 * cleared in SetPageUptodate. This is not an issue for newly
> > +	 * allocated pages that are brought uptodate by zeroing memory.
> > +	 */
> > +	smp_wmb();
> > +	__set_bit(PG_uptodate, &(page)->flags);
> > +}
> 
> __SetPageUptodate() might be more conventional.

I guess so. I guess that the __ variants *can* only be used on new pages
anyway. I wanted to make it clear that it wasn't a non-atomic version of
exactly the same operation, but __SetPageUptodate probably would be fine.

> Boy we'd better get the callers of this little handgrenade right.

Newly initialised pages, before they become visible to anyone else. We
could put a BUG_ON(page_count(page) != 1); in there?


  reply	other threads:[~2007-02-26  2:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-15  7:31 [patch 0/3] 2.6.20 fix for PageUptodate memorder problem (try 4) Nick Piggin
2007-02-15  7:31 ` [patch 1/3] mm: make read_cache_page synchronous Nick Piggin
2007-02-15  7:31 ` [patch 2/3] fs: buffer don't PageUptodate without page locked Nick Piggin
2007-02-15  7:31 ` [patch 3/3] mm: fix PageUptodate memorder Nick Piggin
2007-02-25 12:06   ` Andrew Morton
2007-02-26  2:37     ` Nick Piggin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-02-10  2:31 [patch 0/3] 2.6.20 fix for PageUptodate memorder problem (try 3) Nick Piggin
2007-02-10  2:31 ` [patch 3/3] mm: fix PageUptodate memorder Nick Piggin

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=20070226023712.GA23985@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --subject='Re: [patch 3/3] mm: fix PageUptodate memorder' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).