lkml.org 
[lkml]   [2008]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mmap: is default non-populating behavior stable?
Hugh Dickins wrote:
>> Thanks to all for answers. I have made the conclusion that doing "open() new
>> file, truncate(<big size>), mmap(<the same big size>), write/read some memory
>> pages" should not populate other, untouched by write/read pages (until
>> MAP_POPULATE given), right?
[snip]
> For a start, it depends on the filesystem: I believe that vfat, for
> example, does not support the concept of sparse files (files with holes
> in), so its truncate(<big size>) will allocate the whole of that big
> size initially.
For my case vfat is not an option fortunately.

> I'm not sure what you mean by "populate": in mm, as in MAP_POPULATE,
> we're thinking of prefaulting pages into the user address space; but
> you're probably thinking of whether the blocks are allocated on disk?
Yes.

>>From time to time we toy with prefaulting adjacent pages when a fault
> occurs (though IIRC tests have proved disappointing in the past): we'd
> like to keep that option open, but it would go against your guidelines
> above to some extent.
It depends how is "adjacent" would count :) If several pages, probably not. If
millions or similar, that would be a problem. It's very convenient to use such
"open+truncate+mmap+write/read" behavior to make self-growing-on-demand cache
in memory with disk as back-end without remaps.

Thanks for descriptive answer.

--
Eugene V. Lyubimkin aka JackYF

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-11-05 18:49    [W:0.047 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site