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

On Tue, 22 Feb 2000 18:46:02 +0100 (MET), Richard Guenther
<richard.guenther@student.uni-tuebingen.de> 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).


--Stephen

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [from the cache]
©2003-2011 Jasper Spaans