From: Jason Baron <jbaron@akamai.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Mel Gorman <mgorman@suse.de>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT
Date: Fri, 8 Jun 2018 16:55:29 -0400 [thread overview]
Message-ID: <ce5c6352-3f35-f02b-5e1b-b22649b15e12@akamai.com> (raw)
In-Reply-To: <20180608125717.c34d3e7125c62fc91ac427c8@linux-foundation.org>
On 06/08/2018 03:57 PM, Andrew Morton wrote:
> On Fri, 8 Jun 2018 14:56:52 -0400 Jason Baron <jbaron@akamai.com> wrote:
>
>> In order to free memory that is marked MLOCK_ONFAULT, the memory region
>> needs to be first unlocked, before calling MADV_DONTNEED. And if the region
>> is to be reused as MLOCK_ONFAULT, we require another call to mlock2() with
>> the MLOCK_ONFAULT flag.
>>
>> Let's simplify freeing memory that is set MLOCK_ONFAULT, by allowing
>> MADV_DONTNEED to work directly for memory that is set MLOCK_ONFAULT. The
>> locked memory limits, tracked by mm->locked_vm do not need to be adjusted
>> in this case, since they were charged to the entire region when
>> MLOCK_ONFAULT was initially set.
>
> Seems useful.
>
> Is a manpage update planned?
>
Yes, I will add a manpage update. I sort of wanted to see first if
people thought this patch was a reasonable thing to do.
> Various updates to tools/testing/selftests/vm/* seem appropriate.
>
Indeed, I started updating tootls/testing/selftests/vm/mlock2-tests.c
with this new interface, but then I realized that that test is failing
before I made any changes. So I will go back and sort that out, and add
additional testing for this new interface.
>> Further, I don't think allowing MADV_FREE for MLOCK_ONFAULT regions makes
>> sense, since the point of MLOCK_ONFAULT is for userspace to know when pages
>> are locked in memory and thus to know when page faults will occur.
>
> This sounds non-backward-compatible?
>
I was making the point of why I think allowing 'MADV_DONTNEED' for
MLOCK_ONFAULT regions makes sense, while allowing 'MADV_FREE' for
MLOCK_ONFAULT regions really does not.
Thanks,
-Jason
next prev parent reply other threads:[~2018-06-08 20:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-08 18:56 Jason Baron
2018-06-08 19:57 ` Andrew Morton
2018-06-08 20:55 ` Jason Baron [this message]
2018-06-09 11:51 ` kbuild test robot
2018-06-11 7:20 ` Michal Hocko
2018-06-11 14:51 ` Jason Baron
2018-06-11 15:03 ` Michal Hocko
2018-06-11 16:23 ` Jason Baron
2018-06-12 7:46 ` Michal Hocko
2018-06-12 14:11 ` Jason Baron
2018-06-13 6:32 ` Vlastimil Babka
2018-06-13 7:15 ` Michal Hocko
2018-06-13 7:51 ` Vlastimil Babka
2018-06-13 8:37 ` Michal Hocko
2018-06-15 19:36 ` Jason Baron
2018-06-20 11:00 ` Michal Hocko
2018-06-28 20:20 ` Jason Baron
2018-06-13 9:13 ` Michal Hocko
2018-06-15 19:28 ` Jason Baron
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=ce5c6352-3f35-f02b-5e1b-b22649b15e12@akamai.com \
--to=jbaron@akamai.com \
--cc=akpm@linux-foundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--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