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

Yes, I have a good case, but my case may not sound interesting until you 
see it working.

Ok, I am developing a dynamic memory allocation routine which takes 
direct advantage of the ability of a machine to use Virtual Memory to 
make everything look contiguous and fast.

And it just doesn't make sens to have mmap() map ANONYMOUS shared memory 
and mremap() not to expand it and make the expanded area available.

I am not a 100% sure, but I don't think correcting its behavior would 
cause a problem.

Would you happen to know how I can work around that issue for now, and 
make writing in an expended area not to generate a Bus error?

Sincerely,
William Tambe


Hugh Dickins wrote:
> On Fri, 29 Jun 2007, William Tambe wrote:
> 
>> I read a post that you made about not being able to expand anonymous shared
>> mapping with mremap(). And I am actually having that issue now.
> 
> I guess you're referring to the thread at
> http://lkml.org/lkml/2004/6/16/155
> and you're asking either Stas or me.
> 
>> You made the post in 2004 and we are now in 2007. I would like to know if that
>> feature was added because the code below always fail with bus error on my
>> machine. I use glibc 2.5
> 
> 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.
> 
> I haven't given it any thought since then:
> do you have a good case for us to reconsider it?
> 
> Hugh
> 
>> Thank you for helping.
>>
>> #define _GNU_SOURCE
>> #include <sys/mman.h>
>> #include <unistd.h>
>>
>> #include <stdio.h>
>>
>> main() {
>>         void *ptr;
>>         if ((ptr=mmap(0, 4096, PROT_READ|PROT_WRITE,
>>                 MAP_ANONYMOUS|MAP_SHARED|MAP_GROWSDOWN, 0, 0)) == -1) {
>>                 printf("failed to mmap\n");
>>                 return;
>>         }
>>
>>         if ((ptr=mremap(ptr, 4096, 8192, MREMAP_MAYMOVE)) == -1) {
>>                 printf("failed to mremap\n");
>>                 return;
>>         }
>>
>>         //why does this failed. I am well in the interval [4096, 8192]
>>         *(unsigned int *)(ptr + 4096 + 8)= 10;
>> }
> 

  reply	other threads:[~2007-07-02 17:37 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 [this message]
2007-07-02 18:21     ` Stas Sergeev
2007-07-02 18:10   ` Stas Sergeev
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=4689375C.2090505@gmail.com \
    --to=tambewilliam@gmail.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stsp@aknet.ru \
    /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