linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@conectiva.com.br>
To: Abhishek Nayani <abhi@kernelnewbies.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [BUG] in do_mmap_pgoff() (2.4.19-preX)
Date: Wed, 19 Jun 2002 09:25:06 -0300 (BRT)	[thread overview]
Message-ID: <Pine.LNX.4.44L.0206190923500.2598-100000@imladris.surriel.com> (raw)
In-Reply-To: <20020616191606.GA1888@SandStorm.net>

On Mon, 17 Jun 2002, Abhishek Nayani wrote:

> 	While documenting the do_mmap_pgoff() function, i found this
> snippet of code very suspicious:
>
>         /* 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;
>
> 	Here we need to quit if *any* one of the condition is true. So I
> think it should be "||" instead of "&&". As according to the present
> code, it quits only if all the 3 conditions is true, which is wrong.

No, the code is correct.

The only case where we end up allocating new pages for
this mapping is when the mapping is both writable and
private.

Read-only mappings and shared mappings always have backing
store, the file from which the mapping comes and empty_zero_page.

regards,

Rik
-- 
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/		http://distro.conectiva.com/

--
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-mm.org/

      reply	other threads:[~2002-06-19 12:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-16 19:16 Abhishek Nayani
2002-06-19 12:25 ` Rik van Riel [this message]

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.44L.0206190923500.2598-100000@imladris.surriel.com \
    --to=riel@conectiva.com.br \
    --cc=abhi@kernelnewbies.org \
    --cc=linux-kernel@vger.kernel.org \
    --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