From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Hugh Dickins <hugh@veritas.com>
Cc: Yingchao Zhou <yc_zhou@ncic.ac.cn>,
linux-kernel <linux-kernel@vger.kernel.org>, akpm <akpm@osdl.org>,
alan <alan@redhat.com>, zxc <zxc@ncic.ac.cn>,
Linux Memory Management <linux-mm@kvack.org>
Subject: Re: [RFC] PAGE_RW Should be added to PAGE_COPY ?
Date: Sat, 16 Sep 2006 17:42:44 +1000 [thread overview]
Message-ID: <450BAAF4.1080509@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.64.0609151431320.22674@blonde.wat.veritas.com>
(adding linux-mm)
Hugh Dickins wrote:
>>but for the app to use a shared mapping instead of a private.
>
>
> But that suggestion wasn't helpful: you'd much prefer not to
> restrict what areas of userspace are used in this way.
>
> The problem, as I now see it, is precisely with do_wp_page()'s
> TestSetPageLocked, as you first said. There is indeed a small
> but real chance that will fail. At some time in the past I did
> realize that, but pushed it to the back of my mind, waiting for
> someone actually to complain: now you have.
>
> Yes, it would be good if we could do that check in some other,
> reliable way. The problem is that can_share_swap_page has to
> check page_mapcount (and PageSwapCache) and page_swapcount in
> an atomic way: the page lock is what we have used to guard the
> movement between mapcount and swapcount.
>
> I'll try to think whether we can do that better,
> but not until next week.
I don't think TestSetPageLocked is the problem. Indeed you may be
able to get around a few specific cases say, by turning that into
a plain lock_page()... but the problem is still fundamentally COW.
In other words, one should always be able to return 0 from that
can_share_swap_page and have the system continue to work... right?
Because even if you hadn't done that mprotect trick, you may still
have a problem because the page may *have* to be copied on write
if it is shared over fork.
So if we filled in the missing mm/ implementation of VM_DONTCOPY
(and call it MAP_DONTCOPY rather than the confusing MAP_DONTFORK)
such that it withstands such an mprotect sequence, we can then ask
that all userspace drivers do their get_user_pages memory on these
types of vmas.
Would that work?
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
WARNING: multiple messages have this Message-ID (diff)
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Hugh Dickins <hugh@veritas.com>
Cc: Yingchao Zhou <yc_zhou@ncic.ac.cn>,
linux-kernel <linux-kernel@vger.kernel.org>, akpm <akpm@osdl.org>,
alan <alan@redhat.com>, zxc <zxc@ncic.ac.cn>,
Linux Memory Management <linux-mm@kvack.org>
Subject: Re: [RFC] PAGE_RW Should be added to PAGE_COPY ?
Date: Sat, 16 Sep 2006 17:42:44 +1000 [thread overview]
Message-ID: <450BAAF4.1080509@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.64.0609151431320.22674@blonde.wat.veritas.com>
(adding linux-mm)
Hugh Dickins wrote:
>>but for the app to use a shared mapping instead of a private.
>
>
> But that suggestion wasn't helpful: you'd much prefer not to
> restrict what areas of userspace are used in this way.
>
> The problem, as I now see it, is precisely with do_wp_page()'s
> TestSetPageLocked, as you first said. There is indeed a small
> but real chance that will fail. At some time in the past I did
> realize that, but pushed it to the back of my mind, waiting for
> someone actually to complain: now you have.
>
> Yes, it would be good if we could do that check in some other,
> reliable way. The problem is that can_share_swap_page has to
> check page_mapcount (and PageSwapCache) and page_swapcount in
> an atomic way: the page lock is what we have used to guard the
> movement between mapcount and swapcount.
>
> I'll try to think whether we can do that better,
> but not until next week.
I don't think TestSetPageLocked is the problem. Indeed you may be
able to get around a few specific cases say, by turning that into
a plain lock_page()... but the problem is still fundamentally COW.
In other words, one should always be able to return 0 from that
can_share_swap_page and have the system continue to work... right?
Because even if you hadn't done that mprotect trick, you may still
have a problem because the page may *have* to be copied on write
if it is shared over fork.
So if we filled in the missing mm/ implementation of VM_DONTCOPY
(and call it MAP_DONTCOPY rather than the confusing MAP_DONTFORK)
such that it withstands such an mprotect sequence, we can then ask
that all userspace drivers do their get_user_pages memory on these
types of vmas.
Would that work?
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-09-16 7:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-15 3:38 Re: Re: [RFC] PAGE_RW Should be added to PAGE_COPY ? Yingchao Zhou
2006-09-15 4:30 ` Hugh Dickins
2006-09-15 14:19 ` Hugh Dickins
2006-09-16 7:42 ` Nick Piggin [this message]
2006-09-16 7:42 ` Nick Piggin
2006-09-23 18:51 ` Hugh Dickins
2006-09-23 18:51 ` Hugh Dickins
2006-09-25 2:53 ` Nick Piggin
2006-09-25 2:53 ` Nick Piggin
-- strict thread matches above, loose matches on Subject: below --
2006-09-13 14:02 Yingchao Zhou
2006-09-14 14: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=450BAAF4.1080509@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=alan@redhat.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=yc_zhou@ncic.ac.cn \
--cc=zxc@ncic.ac.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.