mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andrea Arcangeli <andrea@suse.de>
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: Fri, 11 Feb 2005 07:23:09 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0502110710150.5866@goblin.wat.veritas.com> (raw)
In-Reply-To: <20050210204025.GS18573@opteron.random>

On Thu, 10 Feb 2005, Andrea Arcangeli wrote:
> On Thu, Feb 10, 2005 at 08:19:47PM +0000, Hugh Dickins wrote:
> > 
> > get_user_pages broke COW in advance of the I/O.  The reason for
> > subsequent COW if the page gets unmapped is precisely because
> > can_share_swap_page used page_count to judge exclusivity, and
> > get_user_pages has bumped that up, so the page appears (in danger
> > of being) non-exclusive when actually it is exclusive.  By changing
> > can_share_swap_page to use page_mapcount, that frustration vanishes.
> 
> What if a second thread does a fork() while the rawio is in progress?
> The page will be again no shareable, and if you unmap it the rawio will
> be currupt if the thread that executed the fork while the I/O is in
> progress writes to a part of the page again after it has been unmapped
> (obviously the part of the page that isn't under read-rawio, rawio works
> with the hardblocksize, not on the whole page). 

I think there's no difference here between the two techniques.

With the new can_share_swap_page, yes, "page_swapcount" goes up with
the fork, the page will be judged non-exclusive, a user write to
another part of the page will replace it by a copy page, and it's
undefined how much of the I/O will be captured in the copy.

But even with the old can_share_swap_page, and try_to_unmap_one
refusing to unmap the page, copy_page_range's COW checking would
still remove write permission from the pte of an anonymous
page, so a user write to another part of the page would find
raised page_count and replace it by a copy page: same behaviour.

And it's fine for the behaviour to be somewhat undefined in this
peculiar case: the important thing is just that the page must not
be freed and reused while I/O occurs, hence get_user_page raising
the page_count - which I'm _not_ proposing to change!

Hugh

  reply	other threads:[~2005-02-11  7:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-03  3:56 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
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 [this message]
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=Pine.LNX.4.61.0502110710150.5866@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=andrea@suse.de \
    --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

all inboxes | Powered by JetHome®