From: Andrea Arcangeli <andrea@suse.de>
To: Hugh Dickins <hugh@veritas.com>
Cc: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>,
linux-kernel@vger.kernel.org, lhms-devel@lists.sourceforge.net
Subject: Re: [RFC] Changing COW detection to be memory hotplug friendly
Date: Thu, 10 Feb 2005 20:05:21 +0100 [thread overview]
Message-ID: <20050210190521.GN18573@opteron.random> (raw)
In-Reply-To: <Pine.LNX.4.61.0502081549320.2203@goblin.wat.veritas.com>
On Tue, Feb 08, 2005 at 04:26:26PM +0000, Hugh Dickins wrote:
> Seems it was okay after all, I got confused by an unrelated issue.
> Here's what I had in mind, what do you think? Does it indeed help
> with your problem? I'm copying Andrea because it was he who devised
> that fix to the get_user_pages issue, and also (I think, longer ago)
> can_share_swap_page itself.
>
> This does rely on us moving 1 from mapcount to swapcount or back only
> while page is locked - there are places (e.g. exit) where mapcount
> comes down without page being locked, but that's not an issue: we just
> have to be sure that once we have mapcount, it can't go up while reading
> swapcount (I've probably changed more than is strictly necessary, but
> this seemed clearest to me).
>
> I've left out how we ensure swapoff makes progress on a page with high
> mapcount, haven't quite made my mind out about that: it's less of an
> issue now there's an activate_page in unuse_pte, plus it's not an
> issue which will much bother anyone but me, can wait until after.
>
> That PageAnon check in do_wp_page: seems worthwhile to avoid locking
> and unlocking the page if it's a file page, leaves can_share_swap_page
> simpler (a PageReserved is never PageAnon). But the patch is against
> 2.6.11-rc3-mm1, so I appear to be breaking the intention of
> do_wp_page_mk_pte_writable ("on a shared-writable page"),
> believe that's already broken but need to study it more.
The reason pinned pages cannot be unmapped is that if they're being
unmapped while a rawio read is in progress, a cow on some shared
swapcache under I/O could happen.
If a try_to_unmap + COW over a shared swapcache happens during a rawio
read, then the rawio reads will get lost generating data corruption.
I had not much time to check the patch yet, but it's quite complex and
could you explain again how do you prevent a cow to happen while the
rawio is in flight if you don't pin the pte? The PG_locked bitflag
cannot matter at all because the rawio read won't lock the page. What
you have to prevent is the pte to be zeroed out, it must be kept
writeable during the whole I/O. I don't see how you can allow unmapping
without running into COWs later on.
This is the only thing I care to understand really, since it's the only
case that the pte pinning was fixing.
Overall I see nothing wrong in preventing memory removal while rawio is
in flight. rawio cannot be in flight forever (ptrace and core dump as
well should complete eventually). Why can't you simply drop pages from
the freelist one by one until all of them are removed from the freelist?
next prev parent reply other threads:[~2005-02-10 19:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-03 3:56 [RFC] Changing COW detection to be memory hotplug friendly IWAMOTO Toshihiro
2005-02-07 21:24 ` Hugh Dickins
2005-02-08 16:26 ` Hugh Dickins
2005-02-10 7:59 ` IWAMOTO Toshihiro
2005-02-10 19:05 ` Andrea Arcangeli [this message]
2005-02-10 19:16 ` Dave Hansen
2005-02-10 19:41 ` Andrea Arcangeli
2005-02-10 20:19 ` Hugh Dickins
2005-02-10 20:40 ` Andrea Arcangeli
2005-02-11 7:23 ` Hugh Dickins
2005-02-11 8:52 ` Andrea Arcangeli
2005-02-11 13:20 ` Hugh Dickins
2005-02-14 17:41 ` Andrea Arcangeli
2005-02-14 18:36 ` Hugh Dickins
2005-02-14 21:41 ` Andrea Arcangeli
2005-02-15 3:17 ` Andrew Morton
2005-02-09 9:08 ` IWAMOTO Toshihiro
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=20050210190521.GN18573@opteron.random \
--to=andrea@suse.de \
--cc=hugh@veritas.com \
--cc=iwamoto@valinux.co.jp \
--cc=lhms-devel@lists.sourceforge.net \
--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