public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@aknet.ru>
To: Hugh Dickins <hugh@veritas.com>
Cc: William Tambe <tambewilliam@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: Concerning a post that you made about expandable anonymous shared mappings
Date: Mon, 02 Jul 2007 22:10:31 +0400	[thread overview]
Message-ID: <46893F97.7080200@aknet.ru> (raw)
In-Reply-To: <Pine.LNX.4.64.0707021619020.32337@blonde.wat.veritas.com>

Hi.

Hugh Dickins wrote:
> You've answered your own question: we did not make the change Stas
> suggested, IIRC because I remained a little uneasy with that change
> in behaviour, and nobody else spoke up for it.
IIRC your argument, that made sense to me,
was that with such an approach, you can only
expand the backing-store, but never shrink.
I agree this is a problem from some point of
view. I have no idea whether it is important
or not, but it definitely _looks_ not very good.

>>         //why does this failed. I am well in the interval [4096, 8192]
>>         *(unsigned int *)(ptr + 4096 + 8)= 10;
>> }
Well, this generates a bus error, while, for
example, doing the same trick with having a
/dev/mem as a backing-store, simply maps the
"enlarged" space with the anonymous memory,
and so does not generate a SIGBUS (not producing
a desired effect either, of course).
Why do we have it both ways? Shouldn't they
(i.e. /dev/zero and /dev/mem mapping) behave
the same after expanding with mremap?

> I haven't given it any thought since then:
I was thinking about it a bit, and I imagined
we need something like
    int mopen(void *addr, size_t len, unsigned int flags);
which will give you an fd for the memory area,
which you can then ftruncate() and mmap() (and
mremap).
It looks like vmsplice() is a very close one,
but unfortunately it involves pipe, which will
not give you an ability to ftruncate() I suppose.
I even asked Jens Axboe about the possibility
to have mopen(). He said it might be a good
optimization (having only one syscall whereas
now 2 are needed (pipe/vmsplice)), but not
worth an efforts.
Now, if maybe someone have a time and patience,
he can explain me what was an advantage of using
pipe with vmsplice() at all. Why it was not
possible to have something like the mopen() above,
that will give you an fd right away, without a
pipe, so that ftruncate/mmap/lseek etc can be
used on it? Well, I guess this was discussed
many times, but I failed to google anything
relevant...
Such a thing could solve that mremap() problem
that me and William Tambe have.


  parent reply	other threads:[~2007-07-02 18:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-29 19:52 Concerning a post that you made about expandable anonymous shared mappings William Tambe
2007-07-02 15:33 ` Hugh Dickins
2007-07-02 17:35   ` William Tambe
2007-07-02 18:21     ` Stas Sergeev
2007-07-02 18:10   ` Stas Sergeev [this message]
2007-07-03 15:48     ` Hugh Dickins
2007-07-03 18:29       ` Stas Sergeev
2007-07-10  1:50       ` William Tambe
2007-07-10 20:10         ` Hugh Dickins
2007-07-10 20:55           ` William Tambe
2007-07-11  4:12             ` Stas Sergeev
2007-07-12  6:35               ` William Tambe

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=46893F97.7080200@aknet.ru \
    --to=stsp@aknet.ru \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tambewilliam@gmail.com \
    /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