Re: [PATCH 3/3] mlock: avoid dirtying pages and triggering writeback

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

 





On Fri, Nov 19, 2010 at 2:23 AM, Michel Lespinasse <walken@xxxxxxxxxx> wrote:
Approaching the problem the other way - would there be any objection to
adding code to do an fallocate() equivalent at the start of mlock ?
This would be a no-op when the file is fully allocated on disk, and would
allow mlock to return an error if the file can't get fully allocated
(no idea what errno should be for such case, though).

My vote would be against.   If you if you mmap a sparse file and then try writing to it willy-nilly, bad things will happen.  This is true without a mlock().   Where is it written that mlock() has anything to do with improving this situation?

If userspace wants to call fallocate() before it calls mlock(), it should do that.  And in fact, in most cases, userspace should be encouraged to do that.   But having mlock() call fallocate() and then return ENOSPC if there's no room?

That just makes me feel icky as all heck.

Look, it was an accident / bug of the implementation that mlock() magically dirtied all these pages.  It might have made some situations better, but I very much doubt applications depended upon it, and I'd really rather not perpetuate this particular magic side effect of the buggy implementation of mlock().

-- Ted


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]