[lkml]   [2007]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [rfc] no ZERO_PAGE?

On Wed, 4 Apr 2007, wrote:
> I'd not be surprised if there's sparse-matrix code out there that wants to
> malloc a *huge* array (like a 1025x1025 array of numbers) that then only
> actually *writes* to several hundred locations, and relies on the fact that
> all the untouched pages read back all-zeros.

Good point. In fact, it doesn't need to be a malloc() - I remember people
doing this with Fortran programs and just having an absolutely incredibly
big BSS (with traditional Fortran, dymic memory allocations are just not

> Of course, said code is probably buggy because it doesn't zero the whole
> thing because you don't usually know if some other function already
> scribbled on that heap page.

Sure you do. If glibc used mmap() or brk(), it *knows* the new data is
zero. So if you use calloc(), for example, it's entirely possible that
a good libc wouldn't waste time zeroing it.

The same is true of BSS. You never clear the BSS with a memset, you just
know it starts out zeroed.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-04-05 02:31    [W:0.099 / U:39.824 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site