# Re: \[PATCH V4 5/6\] mm: mmap: Add mmap flag to request VM\_LOCKONFAULT

- From: Eric B Munson \<hidden\>
- Date: 2015-07-22 14:32:26 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2015/07/4540612
- Thread: https://ratatoskr.run/linux-alpha/2015/07/4540016/t.md

```text
On Wed, 22 Jul 2015, Kirill A. Shutemov wrote:

> On Tue, Jul 21, 2015 at 03:59:40PM -0400, Eric B Munson wrote:
> > The cost of faulting in all memory to be locked can be very high when
> > working with large mappings.  If only portions of the mapping will be
> > used this can incur a high penalty for locking.
> > 
> > Now that we have the new VMA flag for the locked but not present state,
> > expose it as an mmap option like MAP_LOCKED -> VM_LOCKED.
> 
> What is advantage over mmap() + mlock(MLOCK_ONFAULT)?

There isn't one, it was added to maintain parity with the
mlock(MLOCK_LOCK) -> mmap(MAP_LOCKED) set.  I think not having will lead
to confusion because we have MAP_LOCKED so why don't we support
LOCKONFAULT from mmap as well.

```

## Attachments

- [signature.asc](https://ratatoskr.run/linux-api/2015/07/4540612/attachment/0) (application/pgp-signature, 819 bytes)
