From: Jonathan Corbet <corbet@lwn.net>
To: Eric B Munson <emunson@akamai.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>, Vlastimil Babka <vbabka@suse.cz>,
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 V3 3/5] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it
Date: Wed, 8 Jul 2015 15:17:50 -0600 [thread overview]
Message-ID: <20150708151750.75e65859@lwn.net> (raw)
In-Reply-To: <20150708203456.GC4669@akamai.com>
On Wed, 8 Jul 2015 16:34:56 -0400
Eric B Munson <emunson@akamai.com> wrote:
> > Quick, possibly dumb question: I've been beating my head against these for
> > a little bit, and I can't figure out what's supposed to happen in this
> > case:
> >
> > mlock2(addr, len, MLOCK_ONFAULT);
> > munlock2(addr, len, MLOCK_LOCKED);
> >
> > It looks to me like it will clear VM_LOCKED without actually unlocking any
> > pages. Is that the intended result?
>
> This is not quite right, what happens when you call munlock2(addr, len,
> MLOCK_LOCKED); is we call apply_vma_flags(addr, len, VM_LOCKED, false).
From your explanation, it looks like what I said *was* right...what I was
missing was the fact that VM_LOCKED isn't set in the first place. So that
call would be a no-op, clearing a flag that's already cleared.
One other question...if I call mlock2(MLOCK_ONFAULT) on a range that
already has resident pages, I believe that those pages will not be locked
until they are reclaimed and faulted back in again, right? I suspect that
could be surprising to users.
Thanks,
jon
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Corbet <corbet@lwn.net>
To: Eric B Munson <emunson@akamai.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>, Vlastimil Babka <vbabka@suse.cz>,
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 V3 3/5] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it
Date: Wed, 8 Jul 2015 15:17:50 -0600 [thread overview]
Message-ID: <20150708151750.75e65859@lwn.net> (raw)
In-Reply-To: <20150708203456.GC4669@akamai.com>
On Wed, 8 Jul 2015 16:34:56 -0400
Eric B Munson <emunson@akamai.com> wrote:
> > Quick, possibly dumb question: I've been beating my head against these for
> > a little bit, and I can't figure out what's supposed to happen in this
> > case:
> >
> > mlock2(addr, len, MLOCK_ONFAULT);
> > munlock2(addr, len, MLOCK_LOCKED);
> >
> > It looks to me like it will clear VM_LOCKED without actually unlocking any
> > pages. Is that the intended result?
>
> This is not quite right, what happens when you call munlock2(addr, len,
> MLOCK_LOCKED); is we call apply_vma_flags(addr, len, VM_LOCKED, false).
>From your explanation, it looks like what I said *was* right...what I was
missing was the fact that VM_LOCKED isn't set in the first place. So that
call would be a no-op, clearing a flag that's already cleared.
One other question...if I call mlock2(MLOCK_ONFAULT) on a range that
already has resident pages, I believe that those pages will not be locked
until they are reclaimed and faulted back in again, right? I suspect that
could be surprising to users.
Thanks,
jon
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Corbet <corbet@lwn.net>
To: Eric B Munson <emunson@akamai.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>, Vlastimil Babka <vbabka@suse.cz>,
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 V3 3/5] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it
Date: Wed, 8 Jul 2015 15:17:50 -0600 [thread overview]
Message-ID: <20150708151750.75e65859@lwn.net> (raw)
Message-ID: <20150708211750.y-FcS0kBKBNcGvIiMT0BPr-gRrrCrai25IoZzIbzGg0@z> (raw)
In-Reply-To: <20150708203456.GC4669@akamai.com>
On Wed, 8 Jul 2015 16:34:56 -0400
Eric B Munson <emunson@akamai.com> wrote:
> > Quick, possibly dumb question: I've been beating my head against these for
> > a little bit, and I can't figure out what's supposed to happen in this
> > case:
> >
> > mlock2(addr, len, MLOCK_ONFAULT);
> > munlock2(addr, len, MLOCK_LOCKED);
> >
> > It looks to me like it will clear VM_LOCKED without actually unlocking any
> > pages. Is that the intended result?
>
> This is not quite right, what happens when you call munlock2(addr, len,
> MLOCK_LOCKED); is we call apply_vma_flags(addr, len, VM_LOCKED, false).
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Corbet <corbet@lwn.net>
To: Eric B Munson <emunson@akamai.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>, Vlastimil Babka <vbabka@suse.cz>,
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 V3 3/5] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it
Date: Wed, 8 Jul 2015 15:17:50 -0600 [thread overview]
Message-ID: <20150708151750.75e65859@lwn.net> (raw)
In-Reply-To: <20150708203456.GC4669@akamai.com>
On Wed, 8 Jul 2015 16:34:56 -0400
Eric B Munson <emunson@akamai.com> wrote:
> > Quick, possibly dumb question: I've been beating my head against these =
for
> > a little bit, and I can't figure out what's supposed to happen in this
> > case:
> >=20
> > mlock2(addr, len, MLOCK_ONFAULT);
> > munlock2(addr, len, MLOCK_LOCKED);
> >=20
> > It looks to me like it will clear VM_LOCKED without actually unlocking =
any
> > pages. Is that the intended result? =20
>=20
> This is not quite right, what happens when you call munlock2(addr, len,
> MLOCK_LOCKED); is we call apply_vma_flags(addr, len, VM_LOCKED, false).
=46rom your explanation, it looks like what I said *was* right...what I was
missing was the fact that VM_LOCKED isn't set in the first place. So that
call would be a no-op, clearing a flag that's already cleared.
One other question...if I call mlock2(MLOCK_ONFAULT) on a range that
already has resident pages, I believe that those pages will not be locked
until they are reclaimed and faulted back in again, right? I suspect that
could be surprising to users.
Thanks,
jon
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Corbet <corbet@lwn.net>
To: Eric B Munson <emunson@akamai.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>, Vlastimil Babka <vbabka@suse.cz>,
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 V3 3/5] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it
Date: Wed, 08 Jul 2015 21:17:50 +0000 [thread overview]
Message-ID: <20150708151750.75e65859@lwn.net> (raw)
In-Reply-To: <20150708203456.GC4669@akamai.com>
On Wed, 8 Jul 2015 16:34:56 -0400
Eric B Munson <emunson@akamai.com> wrote:
> > Quick, possibly dumb question: I've been beating my head against these for
> > a little bit, and I can't figure out what's supposed to happen in this
> > case:
> >
> > mlock2(addr, len, MLOCK_ONFAULT);
> > munlock2(addr, len, MLOCK_LOCKED);
> >
> > It looks to me like it will clear VM_LOCKED without actually unlocking any
> > pages. Is that the intended result?
>
> This is not quite right, what happens when you call munlock2(addr, len,
> MLOCK_LOCKED); is we call apply_vma_flags(addr, len, VM_LOCKED, false).
From your explanation, it looks like what I said *was* right...what I was
missing was the fact that VM_LOCKED isn't set in the first place. So that
call would be a no-op, clearing a flag that's already cleared.
One other question...if I call mlock2(MLOCK_ONFAULT) on a range that
already has resident pages, I believe that those pages will not be locked
until they are reclaimed and faulted back in again, right? I suspect that
could be surprising to users.
Thanks,
jon
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Corbet <corbet@lwn.net>
To: Eric B Munson <emunson@akamai.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>, Vlastimil Babka <vbabka@suse.cz>,
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 V3 3/5] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it
Date: Wed, 8 Jul 2015 15:17:50 -0600 [thread overview]
Message-ID: <20150708151750.75e65859@lwn.net> (raw)
In-Reply-To: <20150708203456.GC4669@akamai.com>
On Wed, 8 Jul 2015 16:34:56 -0400
Eric B Munson <emunson@akamai.com> wrote:
> > Quick, possibly dumb question: I've been beating my head against these for
> > a little bit, and I can't figure out what's supposed to happen in this
> > case:
> >
> > mlock2(addr, len, MLOCK_ONFAULT);
> > munlock2(addr, len, MLOCK_LOCKED);
> >
> > It looks to me like it will clear VM_LOCKED without actually unlocking any
> > pages. Is that the intended result?
>
> This is not quite right, what happens when you call munlock2(addr, len,
> MLOCK_LOCKED); is we call apply_vma_flags(addr, len, VM_LOCKED, false).
From your explanation, it looks like what I said *was* right...what I was
missing was the fact that VM_LOCKED isn't set in the first place. So that
call would be a no-op, clearing a flag that's already cleared.
One other question...if I call mlock2(MLOCK_ONFAULT) on a range that
already has resident pages, I believe that those pages will not be locked
until they are reclaimed and faulted back in again, right? I suspect that
could be surprising to users.
Thanks,
jon
--
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-08 21:17 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 17:03 [PATCH V3 0/5] Allow user to request memory to be locked on page fault Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` [PATCH V3 1/5] mm: mlock: Refactor mlock, munlock, and munlockall code Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` [PATCH V3 2/5] mm: mlock: Add new mlock, munlock, and munlockall system calls Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-08 6:46 ` Heiko Carstens
2015-07-08 6:46 ` Heiko Carstens
2015-07-08 6:46 ` Heiko Carstens
2015-07-08 6:46 ` Heiko Carstens
2015-07-08 6:46 ` Heiko Carstens
2015-07-08 7:02 ` Geert Uytterhoeven
2015-07-08 7:02 ` Geert Uytterhoeven
2015-07-08 7:02 ` Geert Uytterhoeven
2015-07-08 7:02 ` Geert Uytterhoeven
2015-07-08 7:02 ` Geert Uytterhoeven
2015-07-08 7:02 ` Geert Uytterhoeven
2015-07-08 7:02 ` Geert Uytterhoeven
2015-07-08 11:06 ` Catalin Marinas
[not found] ` <1436288623-13007-3-git-send-email-emunson-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>
2015-07-08 11:06 ` Catalin Marinas
2015-07-08 11:06 ` Catalin Marinas
2015-07-08 11:06 ` Catalin Marinas
2015-07-08 11:06 ` Catalin Marinas
2015-07-08 11:06 ` Catalin Marinas
2015-07-08 11:06 ` Catalin Marinas
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` [PATCH V3 3/5] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-08 19:23 ` Jonathan Corbet
2015-07-08 19:23 ` Jonathan Corbet
2015-07-08 19:23 ` Jonathan Corbet
2015-07-08 20:34 ` Eric B Munson
2015-07-08 20:34 ` Eric B Munson
2015-07-08 21:17 ` Jonathan Corbet [this message]
2015-07-08 21:17 ` Jonathan Corbet
2015-07-08 21:17 ` Jonathan Corbet
2015-07-08 21:17 ` Jonathan Corbet
2015-07-08 21:17 ` Jonathan Corbet
2015-07-08 21:17 ` Jonathan Corbet
2015-07-09 18:46 ` Eric B Munson
2015-07-09 18:46 ` Eric B Munson
2015-07-10 16:11 ` Jonathan Corbet
2015-07-10 16:11 ` Jonathan Corbet
2015-07-10 16:11 ` Jonathan Corbet
[not found] ` <20150710101118.5d04d627-T1hC0tSOHrs@public.gmane.org>
2015-07-10 16:19 ` Eric B Munson
2015-07-10 16:19 ` Eric B Munson
2015-07-10 16:19 ` Eric B Munson
2015-07-21 15:35 ` Vlastimil Babka
2015-07-21 15:35 ` Vlastimil Babka
2015-07-21 15:35 ` Vlastimil Babka
2015-07-07 17:03 ` [PATCH V3 4/5] mm: mmap: Add mmap flag to request VM_LOCKONFAULT Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-18 19:11 ` Paul Gortmaker
2015-07-18 19:11 ` Paul Gortmaker
2015-07-20 20:40 ` Chris Metcalf
2015-07-20 20:40 ` Chris Metcalf
2015-07-20 20:40 ` Chris Metcalf
2015-07-21 15:37 ` Eric B Munson
2015-07-22 14:10 ` Paul Gortmaker
2015-07-22 14:10 ` Paul Gortmaker
2015-07-22 14:10 ` Paul Gortmaker
[not found] ` <1436288623-13007-1-git-send-email-emunson-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>
2015-07-07 17:03 ` [PATCH V3 5/5] selftests: vm: Add tests for lock on fault Eric B Munson
2015-07-07 17:03 ` Eric B Munson
2015-07-07 17:03 ` Eric B Munson
[not found] ` <1436288623-13007-6-git-send-email-emunson-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>
2015-07-07 21:51 ` Andrew Morton
2015-07-07 21:51 ` Andrew Morton
2015-07-07 21:51 ` Andrew Morton
2015-07-07 21:16 ` [PATCH V3 0/5] Allow user to request memory to be locked on page fault Andrew Morton
2015-07-07 21:16 ` Andrew Morton
2015-07-07 21:16 ` Andrew Morton
2015-07-07 21:16 ` Andrew Morton
2015-07-08 13:23 ` Eric B Munson
2015-07-08 13:23 ` Eric B Munson
2015-07-08 17:00 ` Andrew Morton
2015-07-08 17:00 ` Andrew Morton
2015-07-08 17:00 ` Andrew Morton
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=20150708151750.75e65859@lwn.net \
--to=corbet@lwn.net \
--cc=akpm@linux-foundation.org \
--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 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.