Re: VM overhead

From: Erik Corry (corry@daimi.au.dk)
Date: Thu May 18 2000 - 08:52:30 EST


On Thu, May 18, 2000 at 10:46:38AM -0300, Rik van Riel wrote:
> On Thu, 18 May 2000, Erik Corry wrote:
>
> > If I mmap 1 Gbyte of VM (anonymously, privately from /dev/zero) but
> > don't use much of it, how much RAM does the system spend managing
> > it? Is there a fixed per-page (4k) overhead for the PTEs?
>
> One page (4 kB) per 4 MB of memory, so 1 MB overhead for
> your 1 GB mapping.

OK.

> > Also, why does top misreport the RSS as 1Gbyte in this case
> > (kernel 2.2.5-22, procps-2.0.2-2)? Kernel bug?
>
> The pages you have not written to all point to the
> zero-filled page. If you set up the mapping you'll
> have 256k mappings to that one page :)

Hmm. Quite misleading but at least internally consistent in some
way. Normally I wouldn't expect the RSS to count a given physical
page more than once.

> > Do I need more real RAM to fork if I have a large mmap like this?
>
> No. You will only need more RAM (or swap) if you
> write to a lot of the pages, otherwise they'll
> keep pointing (COW) to the zero-filled page.

But I do need the 4k-page per 4Mbyte mapping to be duplicated, right?
Or is that copy-on-write too?

-- 
Erik Corry erik@arbat.com     Ceterum censeo, Microsoftem esse delendam!

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:15 EST