From: David Mosberger <davidm@napali.hpl.hp.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: davidm@hpl.hp.com, linux-kernel@vger.kernel.org
Subject: Re: MAP_NORESERVE with MAP_SHARED
Date: Fri, 12 Jul 2002 14:39:58 -0700 [thread overview]
Message-ID: <15663.19630.906087.875400@napali.hpl.hp.com> (raw)
In-Reply-To: <1026512102.9915.22.camel@irongate.swansea.linux.org.uk>
>>>>> On 12 Jul 2002 23:15:02 +0100, Alan Cox <alan@lxorguk.ukuu.org.uk> said:
Alan> On Fri, 2002-07-12 at 21:39, David Mosberger wrote:
>> Is there a good reason why the MAP_NORESERVE flag is ignored when
>> MAP_SHARED is specified? (Hint: it's the call to vm_enough_memory()
>> in shmem_file_setup() that's causing MAP_NORESERVE to be ignored.)
Alan> In no overcommit mode MAP_NORESERVE is never honoured. In conventional
Alan> overcommit mode I may have broken something between base and -ac. Which
Alan> bit of the code are you looking at ?
2.4.18, though as far as I looked, the latest 2.5 has the same behavior.
Specifically, in do_mmap_pgoff() we have:
/* Private writable mapping? Check memory availability.. */
if ((vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE &&
!(flags & MAP_NORESERVE) &&
!vm_enough_memory(len >> PAGE_SHIFT))
return -ENOMEM;
and in shmem_file_setup() we have:
if (!vm_enough_memory((size) >> PAGE_CACHE_SHIFT))
return ERR_PTR(-ENOMEM);
So, if we don't have MAP_SHARED (first case), MAP_NORESERVE is
honored, whereas with MAP_SHARED (second case), MAP_NORESERVE is
ignored.
--david
next prev parent reply other threads:[~2002-07-12 21:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-12 20:39 David Mosberger
2002-07-12 22:15 ` Alan Cox
2002-07-12 21:13 ` Robert Love
2002-07-12 21:39 ` David Mosberger [this message]
2002-07-13 13:11 ` 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=15663.19630.906087.875400@napali.hpl.hp.com \
--to=davidm@napali.hpl.hp.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davidm@hpl.hp.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
all inboxes | Powered by JetHome®