Subject: Re: CVS commit: src/usr.bin/cmp
To: None <>
From: Jason Thorpe <>
List: tech-userlevel
Date: 02/06/2005 13:50:38
On Feb 6, 2005, at 1:19 PM, David Laight wrote:

> Module Name:	src
> Committed By:	dsl
> Date:		Sun Feb  6 21:19:47 UTC 2005
> Modified Files:
> 	src/usr.bin/cmp: regular.c
> Log Message:
> mmap normal files in 1MB chunks.
> Due to a bug in mmap() the address space isn't counted against ulimit
> until the page is faulted in - so mmapping a large file suceeds, but
> cmp SIGSEGVs when it runs out of address space.
> Also I don't believe that the madvise( MAP_SEQUENTIAL) has the desired
> effect, and mmaping a large file is probably very bad for the UBC.

One should mmap files in chunks like this anyway, because otherwise you 
could only cmp e.g. a 3G-minus-some file on i386, for example.

However, I don't see how mmap'ing a large file is "probably very bad 
for the UBC", nor have you provided any data that backs up your 
assertion that MADV_SEQUENTIAL is not working.  Perhaps you simply 
don't understand how the implementation is intended to work.

-- thorpej