From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Eric B Munson <emunson@akamai.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>, Vlastimil Babka <vbabka@suse.cz>,
Jonathan Corbet <corbet@lwn.net>,
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-arch@vger.kernel.org,
linux-api@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH V5 4/7] mm: mlock: Add mlock flags to enable VM_LOCKONFAULT usage
Date: Mon, 27 Jul 2015 10:15:18 +0300 [thread overview]
Message-ID: <20150727071518.GD11657@node.dhcp.inet.fi> (raw)
In-Reply-To: <1437773325-8623-5-git-send-email-emunson@akamai.com>
On Fri, Jul 24, 2015 at 05:28:42PM -0400, Eric B Munson wrote:
> The previous patch introduced a flag that specified pages in a VMA
> should be placed on the unevictable LRU, but they should not be made
> present when the area is created. This patch adds the ability to set
> this state via the new mlock system calls.
>
> We add MLOCK_ONFAULT for mlock2 and MCL_ONFAULT for mlockall.
> MLOCK_ONFAULT will set the VM_LOCKONFAULT flag as well as the VM_LOCKED
> flag for the target region. MCL_CURRENT and MCL_ONFAULT are used to
> lock current mappings. With MCL_CURRENT all pages are made present and
> with MCL_ONFAULT they are locked when faulted in. When specified with
> MCL_FUTURE all new mappings will be marked with VM_LOCKONFAULT.
>
> Currently, mlockall() clears all VMA lock flags and then sets the
> requested flags. For instance, if a process has MCL_FUTURE and
> MCL_CURRENT set, but they want to clear MCL_FUTURE this would be
> accomplished by calling mlockall(MCL_CURRENT). This still holds with
> the introduction of MCL_ONFAULT. Each call to mlockall() resets all
> VMA flags to the values specified in the current call. The new mlock2
> system call behaves in the same way. If a region is locked with
> MLOCK_ONFAULT and a user wants to force it to be populated now, a second
> call to mlock2(MLOCK_LOCKED) will accomplish this.
>
> munlock() will unconditionally clear both vma flags. munlockall()
> unconditionally clears for VMA flags on all VMAs and in the
> mm->def_flags field.
>
> Signed-off-by: Eric B Munson <emunson@akamai.com>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
> Cc: linux-alpha@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linux-parisc@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-xtensa@linux-xtensa.org
> Cc: linux-arch@vger.kernel.org
> Cc: linux-api@vger.kernel.org
> Cc: linux-mm@kvack.org
> ---
> Changes from V4:
> * Split addition of VMA flag
>
> Changes from V3:
> * Do extensive search for VM_LOCKED and ensure that VM_LOCKONFAULT is also handled
> where appropriate
> arch/alpha/include/uapi/asm/mman.h | 2 ++
> arch/mips/include/uapi/asm/mman.h | 2 ++
> arch/parisc/include/uapi/asm/mman.h | 2 ++
> arch/powerpc/include/uapi/asm/mman.h | 2 ++
> arch/sparc/include/uapi/asm/mman.h | 2 ++
> arch/tile/include/uapi/asm/mman.h | 3 +++
> arch/xtensa/include/uapi/asm/mman.h | 2 ++
Again, you can save few lines by moving some code into mman-common.h.
Otherwise looks good.
--
Kirill A. Shutemov
--
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>
next prev parent reply other threads:[~2015-07-27 7:15 UTC|newest]
Thread overview: 28+ 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 ` [PATCH V5 1/7] mm: mlock: Refactor mlock, munlock, and munlockall code Eric B Munson
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-27 6:43 ` Kirill A. Shutemov
2015-07-24 21:28 ` [PATCH V5 3/7] mm: Introduce VM_LOCKONFAULT Eric B Munson
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-27 7:15 ` Kirill A. Shutemov [this message]
2015-07-24 21:28 ` [PATCH V5 5/7] mm: mmap: Add mmap flag to request VM_LOCKONFAULT Eric B Munson
2015-07-27 7:31 ` Kirill A. Shutemov
2015-07-27 13:41 ` Eric B Munson
2015-07-27 14:03 ` Kirill A. Shutemov
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 ` [PATCH V5 7/7] mips: Add entry for new mlock2 syscall 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 13:35 ` Eric B Munson
2015-07-27 14:16 ` Vlastimil Babka
2015-07-27 14:54 ` Eric B Munson
2015-07-27 15:40 ` Vlastimil Babka
2015-07-28 11:17 ` Michal Hocko
2015-07-28 11:23 ` Vlastimil Babka
2015-07-28 13:49 ` Eric B Munson
2015-07-28 15:10 ` Vlastimil Babka
2015-07-28 18:06 ` Eric B Munson
2015-07-29 10:45 ` Michal Hocko
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=20150727071518.GD11657@node.dhcp.inet.fi \
--to=kirill@shutemov.name \
--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=mhocko@suse.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).