All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Eric B Munson <emunson@akamai.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Ralf Baechle <ralf@linux-mips.org>,
	linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@linux-mips.org, linux-parisc@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org,
	linux-xtensa@linux-xtensa.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [PATCH V5 0/7] Allow user to request memory to be locked on page fault
Date: Tue, 28 Jul 2015 13:17:25 +0200	[thread overview]
Message-ID: <20150728111725.GG24972@dhcp22.suse.cz> (raw)
In-Reply-To: <20150727145409.GB21664@akamai.com>

[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

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Eric B Munson <emunson@akamai.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Ralf Baechle <ralf@linux-mips.org>,
	linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@linux-mips.org, linux-parisc@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org,
	linux-xtensa@linux-xtensa.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [PATCH V5 0/7] Allow user to request memory to be locked on page fault
Date: Tue, 28 Jul 2015 11:17:25 +0000	[thread overview]
Message-ID: <20150728111725.GG24972@dhcp22.suse.cz> (raw)
In-Reply-To: <20150727145409.GB21664@akamai.com>

[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

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Eric B Munson <emunson@akamai.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Ralf Baechle <ralf@linux-mips.org>,
	linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@linux-mips.org, linux-parisc@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org,
	linux-xtensa@linux-xtensa.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [PATCH V5 0/7] Allow user to request memory to be locked on page fault
Date: Tue, 28 Jul 2015 13:17:25 +0200	[thread overview]
Message-ID: <20150728111725.GG24972@dhcp22.suse.cz> (raw)
In-Reply-To: <20150727145409.GB21664@akamai.com>

[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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-07-28 11:17 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 21:28 [PATCH V5 0/7] Allow user to request memory to be locked on page fault Eric B Munson
2015-07-24 21:28 ` Eric B Munson
2015-07-24 21:28 ` Eric B Munson
2015-07-24 21:28 ` [PATCH V5 1/7] mm: mlock: Refactor mlock, munlock, and munlockall code Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-27  6:31   ` Kirill A. Shutemov
2015-07-27  6:31     ` Kirill A. Shutemov
2015-07-24 21:28 ` [PATCH V5 2/7] mm: mlock: Add new mlock system call Eric B Munson
2015-07-24 21:28 ` Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-27  6:43   ` Kirill A. Shutemov
2015-07-27  6:43     ` Kirill A. Shutemov
2015-07-27  6:43     ` Kirill A. Shutemov
2015-07-27  6:43     ` Kirill A. Shutemov
2015-07-27  6:43     ` Kirill A. Shutemov
2015-07-27  6:43   ` Kirill A. Shutemov
2015-07-24 21:28 ` [PATCH V5 3/7] mm: Introduce VM_LOCKONFAULT Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-27  7:02   ` Kirill A. Shutemov
2015-07-27  7:02     ` Kirill A. Shutemov
2015-07-27  7:02     ` Kirill A. Shutemov
2015-07-24 21:28 ` [PATCH V5 4/7] mm: mlock: Add mlock flags to enable VM_LOCKONFAULT usage Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-27  7:15   ` Kirill A. Shutemov
2015-07-27  7:15     ` Kirill A. Shutemov
2015-07-27  7:15     ` Kirill A. Shutemov
2015-07-24 21:28 ` [PATCH V5 5/7] mm: mmap: Add mmap flag to request VM_LOCKONFAULT Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-27  7:31   ` Kirill A. Shutemov
2015-07-27  7:31     ` Kirill A. Shutemov
2015-07-27  7:31     ` Kirill A. Shutemov
2015-07-27 13:41     ` Eric B Munson
2015-07-27 13:41       ` Eric B Munson
2015-07-27 14:03       ` Kirill A. Shutemov
2015-07-27 14:03         ` Kirill A. Shutemov
2015-07-27 14:03         ` Kirill A. Shutemov
2015-07-27 14:11         ` Eric B Munson
2015-07-27 14:11           ` Eric B Munson
2015-07-24 21:28 ` [PATCH V5 6/7] selftests: vm: Add tests for lock on fault Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-24 21:28 ` [PATCH V5 7/7] mips: Add entry for new mlock2 syscall Eric B Munson
2015-07-24 21:28   ` Eric B Munson
2015-07-27  9:08 ` [PATCH V5 0/7] Allow user to request memory to be locked on page fault Vlastimil Babka
2015-07-27  9:08   ` Vlastimil Babka
2015-07-27  9:08   ` Vlastimil Babka
2015-07-27 13:35   ` Eric B Munson
2015-07-27 13:35     ` Eric B Munson
2015-07-27 14:16     ` Vlastimil Babka
2015-07-27 14:16       ` Vlastimil Babka
2015-07-27 14:16       ` Vlastimil Babka
2015-07-27 14:54       ` Eric B Munson
2015-07-27 14:54         ` Eric B Munson
2015-07-27 15:40         ` Vlastimil Babka
2015-07-27 15:40           ` Vlastimil Babka
2015-07-27 15:40           ` Vlastimil Babka
2015-07-28 11:17         ` Michal Hocko [this message]
2015-07-28 11:17           ` Michal Hocko
2015-07-28 11:17           ` Michal Hocko
2015-07-28 11:23           ` Vlastimil Babka
2015-07-28 11:23             ` Vlastimil Babka
2015-07-28 11:23             ` Vlastimil Babka
2015-07-28 13:49           ` Eric B Munson
2015-07-28 13:49             ` Eric B Munson
2015-07-28 15:10             ` Vlastimil Babka
2015-07-28 15:10               ` Vlastimil Babka
2015-07-28 15:10               ` Vlastimil Babka
2015-07-28 18:06               ` Eric B Munson
2015-07-28 18:06                 ` Eric B Munson
2015-07-29 10:45             ` Michal Hocko
2015-07-29 10:45               ` Michal Hocko
2015-07-29 10:45               ` Michal Hocko
2015-07-29 10:49               ` Vlastimil Babka
2015-07-29 10:49                 ` Vlastimil Babka
2015-07-29 10:49                 ` Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150728111725.GG24972@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=emunson@akamai.com \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mtk.manpages@gmail.com \
    --cc=ralf@linux-mips.org \
    --cc=shuahkh@osg.samsung.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.