The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Hugh Dickins <hugh@veritas.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: rmap: page_mapping barrier
Date: Thu, 8 Apr 2004 17:12:45 +0200	[thread overview]
Message-ID: <20040408151245.GA31667@dualathlon.random> (raw)
In-Reply-To: <Pine.LNX.4.44.0404081409240.7010-100000@localhost.localdomain>

On Thu, Apr 08, 2004 at 02:22:29PM +0100, Hugh Dickins wrote:
> My page_mapping(page) says PageAnon(page)? NULL: page->mapping;
> I've just realized, looking again at sync_page but it goes way
> beyond it, that we need smp barriers of some kind somewhere,
> don't we?  That is, we cannot just write the address of one of
> our non-address_space structures into page->mapping, without
> being very careful that others will see the PageAnon and treat
> it as NULL.  There are places all over using page_mapping(page)
> while another cpu might be right in page_add_rmap.  I go very
> mushy when it comes to barriers, you understand them better
> than most, any idea what we need to do in page_mapping(page),
> and when setting and clearing PageAnon?

could you elaborate those many places that execute page_mapping while
the other cpu does page_add_rmap or page_remove_rmap?

If the VM does a page_mapping in the pagecache layer in my tree, that
means we already executed page_add_rmap long before calling
__add_to_page_cache, the __add_to_page_cache/__remove_from_page_cache
spinlocks are enough to serialize PageAnon. That covers sync_page and
the rest of the pagecache layer.

There's just one place that I'm wondering about and it's page_mapping in
memory.c but it only changes a mark_page_accessed so I don't see any
trouble whatever happens there (mark_page_accessed can be run on any
random page anytime and it cannot do any harm). I believe we can live
with that race just fine, it's controlled by mark_page_accessed
internally by checking PageLru inside the zone->lru_lock.

Please elaborate which is the place that can run at the same time of
page_add_rmap/page_remove_rmap (I mean of the _first_ or _last_
page_add_rmap/page_remove_rmap, the ones that are allowed toggle the
PageAnon bitflag, all the nested ones are harmless).

  reply	other threads:[~2004-04-08 15:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-08 13:22 rmap: page_mapping barrier Hugh Dickins
2004-04-08 15:12 ` Andrea Arcangeli [this message]
2004-04-08 17:49   ` Hugh Dickins
2004-04-08 18:07     ` Andrea Arcangeli
2004-04-08 18:48       ` Hugh Dickins

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=20040408151245.GA31667@dualathlon.random \
    --to=andrea@suse.de \
    --cc=hugh@veritas.com \
    --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