# \[PATCH V4 2/6\] mm: mlock: Add new mlock, munlock, and munlockall system calls

- From: Vlastimil Babka \<hidden\>
- Date: 2015-07-22 09:16:23 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2015/07/4540399
- Thread: https://ratatoskr.run/linux-alpha/2015/07/4540016/t.md

```text
On 07/21/2015 09:59 PM, Eric B Munson wrote:
> With the refactored mlock code, introduce new system calls for mlock,
> munlock, and munlockall.  The new calls will allow the user to specify
> what lock states are being added or cleared.  mlock2 and munlock2 are
> trivial at the moment, but a follow on patch will add a new mlock state
> making them useful.
>
> munlock2 addresses a limitation of the current implementation.  If a

   ^ munlockall2?

> user calls mlockall(MCL_CURRENT | MCL_FUTURE) and then later decides
> that MCL_FUTURE should be removed, they would have to call munlockall()
> followed by mlockall(MCL_CURRENT) which could potentially be very
> expensive.  The new munlockall2 system call allows a user to simply
> clear the MCL_FUTURE flag.
>
```
