[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce5c6352-3f35-f02b-5e1b-b22649b15e12@akamai.com>
Date: Fri, 8 Jun 2018 16:55:29 -0400
From: Jason Baron <jbaron@...mai.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Michal Hocko <mhocko@...e.com>,
Vlastimil Babka <vbabka@...e.cz>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Mel Gorman <mgorman@...e.de>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is
MLOCK_ONFAULT
On 06/08/2018 03:57 PM, Andrew Morton wrote:
> On Fri, 8 Jun 2018 14:56:52 -0400 Jason Baron <jbaron@...mai.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
Powered by blists - more mailing lists