Subject: Re: sparse core dumps?
To: Hubert Feyrer <hubert@feyrer.de>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 06/02/2004 15:25:05
On Jun 2, 2004, at 2:25 PM, Hubert Feyrer wrote:

>
> When I malloc(3) some space, it doesn't have a significant impact on 
> the
> program's memory usage, i.e. I can happily request 1GB and nothing will
> happen.
>
> But as soon as a core dump gets created, it seems that pages are 
> allocated
> just to dump them out - looking at core dump sizes indicates this.
> What's really bad is that the system's performance is _really_ bad 
> while
> writing out that core dump.
>
> To illustrate, run the program below with some different values (10000,
> 100000, 1000000, 10000000, ..) and look at the resulting core sizes.
> Plus observe system performance during the core dump.
>
> Would it be possible to allow core dumps to be "sparse"?

I've proposed before that a read-only access to a demand zero page does
not allocate a new page, but instead generates a copy-on-write reference
to a zero-page.  (instead of allocating a free page and placing a
writable page into the vmspace).

The other alternative is to make the coredump code much more 
knowledgeable
about uvm internals so it can create sections akin to .bss (ALLOC but no
CONTENTS).
-- 
Matt Thomas                     email: matt@3am-software.com
3am Software Foundry              www: http://3am-software.com/bio/matt/
Cupertino, CA              disclaimer: I avow all knowledge of this 
message.