From: Linus Torvalds <torvalds@transmeta.com>
To: Kanoj Sarcar <kanoj@google.engr.sgi.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.rutgers.edu
Subject: Re: [RFC] [RFT] Shared /dev/zero mmaping feature
Date: Sat, 26 Feb 2000 08:38:13 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.10.10002260827210.747-100000@penguin.transmeta.com> (raw)
In-Reply-To: <200002252308.PAA76871@google.engr.sgi.com>
On Fri, 25 Feb 2000, Kanoj Sarcar wrote:
>
> This is a patch against 2.3.47 that tries to implement shared /dev/zero
> mappings. This is just a first cut attempt, I am hoping I will find a
> few people to apply the patch and throw some real life programs at it
> (preferably on low memory machines so that swapping is induced).
I'd like to see the shm code use the page cache exclusively to track
pages, and this is going to mess with that, I think. We'll need an inode
(or at least a "struct address_space") to act as a "anchor" for the pages,
and it mustn't be the "/dev/zero" inode.
Before that is done I'd be nervous about letting external things call into
the shm subsystem, but maybe this is ok as-is (the only thing you really
export is "map_zero_setup()", and I guess it can just be updated as
required..)
However, whether that will be changed or not, the following looks really
wrong:
> if (vma->vm_flags & VM_SHARED)
> if (ret = map_zero_setup(vma))
> return ret;
> if (zeromap_page_range(vma->vm_start, vma->vm_end - vma->vm_start, vma->vm_page_prot))
> return -EAGAIN;
I do NOT believe that it can ever be right to do a "zeromap_page_range()"
on a shared memory area. I'll tell you why:
mmap(/dev/zero, MAP_SHARED)
child = fork();
if (child) {
..modify mapping..
} else {
..wait for modifications to show up..
}
the "zeromap_page_range()" thing mapped the area with private NULL pages.
The fork() copied the page tables. The modification of the private NULL
page causes the child to get a real shared page, but the mother will never
see that shared page if it only reads from the mapping because the mother
will still see the private one.
So I suspect at the very least it would have to be
if (vma->vm_flags & VM_SHARED)
return map_zero_setup(vma);
and let the whole area be populated with shared pages by "nopage".
Comments?
Linus
--
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.eu.org/Linux-MM/
next prev parent reply other threads:[~2000-02-26 16:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-25 23:08 Kanoj Sarcar
2000-02-26 16:38 ` Linus Torvalds [this message]
2000-02-26 21:47 ` Kanoj Sarcar
2000-02-29 10:54 ` Christoph Rohland
2000-02-29 18:30 ` Kanoj Sarcar
2000-03-01 12:08 ` Christoph Rohland
2000-03-01 17:34 ` Kanoj Sarcar
2000-03-01 17:55 ` Christoph Rohland
2000-03-01 18:18 ` Kanoj Sarcar
2000-03-01 19:42 ` Christoph Rohland
2000-03-01 20:09 ` Kanoj Sarcar
2000-03-06 22:43 ` Stephen C. Tweedie
2000-03-06 23:01 ` Kanoj Sarcar
2000-03-08 12:02 ` Christoph Rohland
2000-03-08 17:51 ` Kanoj Sarcar
2000-03-08 18:35 ` Christoph Rohland
2000-03-08 18:48 ` Linus Torvalds
2000-03-08 18:57 ` Kanoj Sarcar
2000-03-09 18:15 ` Christoph Rohland
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.10.10002260827210.747-100000@penguin.transmeta.com \
--to=torvalds@transmeta.com \
--cc=kanoj@google.engr.sgi.com \
--cc=linux-kernel@vger.rutgers.edu \
--cc=linux-mm@kvack.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