Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1194134

Re: [PATCH V5 0/7] Allow user to request memory to be locked on page fault

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH V5 0/7] Allow user to request memory to be locked on page fault
Date 2015-07-28 13:20 +0200
Message-ID <pRb5p-7Bt-47@gated-at.bofh.it> (permalink)
References <pPSHv-10r-3@gated-at.bofh.it> <pQMA2-5uD-7@gated-at.bofh.it> <pQQNk-3iH-7@gated-at.bofh.it> <pQRq3-4iB-49@gated-at.bofh.it> <pQS2L-52h-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[I am sorry but I didn't get to this sooner.]

On Mon 27-07-15 10:54:09, Eric B Munson wrote:
> Now that VM_LOCKONFAULT is a modifier to VM_LOCKED and
> cannot be specified independentally, it might make more sense to mirror
> that relationship to userspace.  Which would lead to soemthing like the
> following:

A modifier makes more sense.
 
> To lock and populate a region:
> mlock2(start, len, 0);
> 
> To lock on fault a region:
> mlock2(start, len, MLOCK_ONFAULT);
> 
> If LOCKONFAULT is seen as a modifier to mlock, then having the flags
> argument as 0 mean do mlock classic makes more sense to me.
> 
> To mlock current on fault only:
> mlockall(MCL_CURRENT | MCL_ONFAULT);
> 
> To mlock future on fault only:
> mlockall(MCL_FUTURE | MCL_ONFAULT);
> 
> To lock everything on fault:
> mlockall(MCL_CURRENT | MCL_FUTURE | MCL_ONFAULT);

Makes sense to me. The only remaining and still tricky part would be
the munlock{all}(flags) behavior. What should munlock(MLOCK_ONFAULT)
do? Keep locked and poppulate the range or simply ignore the flag an
just unlock?

I can see some sense to allow munlockall(MCL_FUTURE[|MLOCK_ONFAULT]),
munlockall(MCL_CURRENT) resp. munlockall(MCL_CURRENT|MCL_FUTURE) but
other combinations sound weird to me.

Anyway munlock with flags opens new doors of trickiness.
-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH V5 0/7] Allow user to request memory to be locked on page  fault Eric B Munson <emunson@akamai.com> - 2015-07-27 15:40 +0200
  Re: [PATCH V5 0/7] Allow user to request memory to be locked on page  fault Vlastimil Babka <vbabka@suse.cz> - 2015-07-27 16:20 +0200
    Re: [PATCH V5 0/7] Allow user to request memory to be locked on page  fault Eric B Munson <emunson@akamai.com> - 2015-07-27 17:00 +0200
      Re: [PATCH V5 0/7] Allow user to request memory to be locked on page  fault Michal Hocko <mhocko@kernel.org> - 2015-07-28 13:20 +0200

csiph-web