From: Stas Sergeev <stsp@aknet.ru>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andrew Morton <akpm@osdl.org>, Christoph Rohland <cr@sap.com>,
linux-kernel@vger.kernel.org
Subject: Re: [patch][rfc] expandable anonymous shared mappings
Date: Sun, 20 Jun 2004 13:46:59 +0400 [thread overview]
Message-ID: <40D55D13.20803@aknet.ru> (raw)
In-Reply-To: <Pine.LNX.4.44.0406200048490.29576-100000@localhost.localdomain>
Hi.
Hugh Dickins wrote:
>> I disagree with this. The way I am using it may look horrible,
>> but yes, I do use it without the fork().
> Then I think you have no reason to use MAP_SHARED: use MAP_PRIVATE
> and you should get the behaviour you require, without kernel change.
Hugh, I think you misunderstood me because
once again I wrote something, said nothing -
happens to me sometimes.
The trick is that I am setting the old_len arg
of mremap() to 0. This means that the new mapping
is created while the old one is *not* being
destroyed. So I get multiple virtual memory
areas referencing the same shared memory region,
lets call them "aliases".
You propose to share the same backing-store
across the multiple processes. Instead, I am
sharing it across the multiple memory areas
of a single process. I can't use MAP_PRIVATE
for that, really.
Then I want to expand my initial pool of shared
mem while preserving the already created "aliases",
and there seems to be no way of doing that:
creating the larger pool and mremap'ing old
one to the beginning of the new one, leaves the
VMAs unmerged; creating the larger pool and
mamcpy() the content of the old one to it,
doesn't preserve the already created "aliases".
The only thing I can do, is to expand the
initial pool with mremap(), which doesn't work.
So I have to resort to the more heavyweight
things like shm_open(), while otherwise the
expandable anonymous shared mapping can suit
very well for my needs.
> Shared anonymous is peculiar: although mapping is anonymous (nothing
> shared with unrelated mms), modifications are shared between parent
> and children. It's half-way between anonymous and file-backed.
> We agree that it might be nice to let the object used to support that
> be extended if mremap extends the mapping. But it might instead just
> be needless feature creep.
But then I beleive the entire idea of anonymous
shared mapping is also a crap. But since it is
already there, I would like to have it fully
functional, so that I can avoid the things like
shm_open() when possible. I just don't see the
reason of keeping something partially implemented.
> Sorry, your case does not persuade me yet.
Well, I beleive perhaps you missed the fact
that I was setting the old_len to 0 in mremap(),
which doesn't work as I want to, when you use
MAP_PRIVATE.
You'll probably call it a horrible hack, but
here's where that technique comes from:
http://www.ussg.iu.edu/hypermail/linux/kernel/0401.1/1351.html
And since it comes from here, I beleive it
must be fully supported.
next prev parent reply other threads:[~2004-06-20 9:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-16 18:12 [patch][rfc] expandable anonymous shared mappings Stas Sergeev
2004-06-18 20:46 ` Hugh Dickins
2004-06-19 9:07 ` Stas Sergeev
2004-06-20 0:20 ` Hugh Dickins
2004-06-20 9:46 ` Stas Sergeev [this message]
2004-06-23 11:23 ` Christoph Rohland
2004-06-23 18:45 ` Stas Sergeev
2004-06-28 14:25 ` Christoph Rohland
2004-06-28 14:22 ` Hugh Dickins
2004-06-28 18:48 ` Stas Sergeev
2004-06-28 21:44 ` Hugh Dickins
2004-06-29 17:06 ` Stas Sergeev
2004-06-29 17:41 ` Hugh Dickins
2004-06-29 19:03 ` Stas Sergeev
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=40D55D13.20803@aknet.ru \
--to=stsp@aknet.ru \
--cc=akpm@osdl.org \
--cc=cr@sap.com \
--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