[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090605122101.f77ed5e2.kamezawa.hiroyu@jp.fujitsu.com>
Date: Fri, 5 Jun 2009 12:21:01 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc: Julian Phillips <julian@...ntumfyre.co.uk>,
linux-kernel@...r.kernel.org
Subject: Re: A question about using a private anonymous mmap
On Fri, 5 Jun 2009 12:06:18 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> On Thu, 4 Jun 2009 17:48:29 +0100 (BST)
> Julian Phillips <julian@...ntumfyre.co.uk> 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?
> >
>
> It comes from removal of ZERO_PAGE.
>
> IMHO, What you can do is mmap(/dev/zero, MAP_PRIVATE) instead of ANON.
>
Ah, sorry, mmap(/dev/zero) trick is no help in current kernel, I misunderstood.
Thanks,
-Kame
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists