All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancockrwd@gmail.com>
To: Julian Phillips <julian@quantumfyre.co.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: A question about using a private anonymous mmap
Date: Thu, 04 Jun 2009 18:24:31 -0600	[thread overview]
Message-ID: <4A2865BF.1080301@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.0906041740110.21303@reaper.quantumfyre.co.uk>

Julian Phillips wrote:
> I have a program which creates a reasonably large private anonymous map. 
> The program then writes into a few places in the map, but ends up 
> reading from all of them.
> 
> When I run this program on a system running 2.6.20.7 the process only 
> ever seems to use enough memory to hold the data that has actually been 
> written (well - in units of PAGE_SIZE).  When I run the program on a 
> system running 2.6.24.5 then as it reads the map the amount of memory 
> used continues to increase until the complete map has actually been 
> allocated (and since the total size is greater than the physically 
> available RAM causes swapping).  Basically I seem to be seeing 
> copy-on-read instead of copy-on-write type behaviour.
> 
> Is this an expected change, and is there any option I can tweak to get 
> the old behaviour back?

Looks like this was as a result of the ZERO_PAGE removal:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=557ed1fa2620dc119adb86b34c614e152a629a80

The commit comment notes: "Inserting a ZERO_PAGE for anonymous read 
faults appears to be a false optimisation: if an application is 
performance critical, it would not be doing many read faults of new 
memory, or at least it could be expected to write to that memory soon 
afterwards. If cache or memory use is critical, it should not be working 
with a significant number of ZERO_PAGEs anyway (a more compact 
representation of zeroes should be used)."

  reply	other threads:[~2009-06-05  0:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 16:48 A question about using a private anonymous mmap Julian Phillips
2009-06-05  0:24 ` Robert Hancock [this message]
2009-06-05 10:36   ` Julian Phillips
2009-06-05  3:06 ` KAMEZAWA Hiroyuki
2009-06-05  3:21   ` KAMEZAWA Hiroyuki

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=4A2865BF.1080301@gmail.com \
    --to=hancockrwd@gmail.com \
    --cc=julian@quantumfyre.co.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.