[lkml]   [2000]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: mmap/munmap semantics

On Tue, 22 Feb 2000 18:46:02 +0100 (MET), Richard Guenther
<> said:

> With the ongoing development of GLAME there arise the following
> problems with the backing-store management, which is a mmaped
> file and does "userspace virtual memory management":
> - I cannot see a way to mmap a part of the file but set the
> contents initially to zero,

All file contents default to zero anyway, so just ftruncate() the file
to create as much demand-zeroed mmapable memory as you want.

> - I need to "drop" a mapping sometimes without writing the contents
> back to disk - I cannot see a way to do this with linux currently.

The only way is to use Chuck Lever's madvise() patches:
madvise(MADV_DONTNEED) is exactly what you need there. It's not yet in
Linus's 2.3 tree, but the API is pretty standard.

> Ideally a hole could be created in the mmapped file on drop time -

No, if the mmaped area has already been flushed to disk then there is no
way at all to recreate the hole except by truncating and then
re-extending the file (which destroys everything until EOF, of course).


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

 \ /
  Last update: 2005-03-22 13:56    [W:0.097 / U:20.836 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site