Re: HAVE_MMAP still necessary ?



> a) cmd.c: compare_files() - it uses the mmap() call directly 
>    (w/o going over mcvfs), and it seems to work on local files 
>    only. wouldn't it make sense to let it run via mcvfs ? 
> 
> b) view.c: it tries to mmap() in the file, obviously to let the
>    kernel do all the loading. 
>    BUT: do we *really* want mmap() here, or just some "get me
>    that file into memory"()-call (same in cmd.c) ?

mmap is more efficient, because the kernel can throw those pages out at
any time (as it knows what the backing store for the file is), so under
memory pressure it can alleviate the system load easily.

Loading the file ourselves means that we load it into dirty pages,
effectively taking memory, and forcing the kernel to write the data to
swap under load, or to keep the data in memory even when not needed.

I do not like the idea of dropping mmap.
  
> In case we just want to have an faster way for loading files into 
> memory (in case it's supported), I suggest some new vfs operation
> for that, let's call it "loadFile()" - it returns some FILE_DATA
> structure, containing size, buffer ptr and a callback vector for
> free'ing. Everyone who wants the whole file (or large blocks) 
> just uses this call instead of ugly #ifdef's, and it's up to vfs
> to decide what to do behind the scenes.

You are trying to invent a bloated replacement for something that the
kernel can do really well.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]