Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-28 Thread Jason Baron
On 06/20/2018 07:00 AM, Michal Hocko wrote: > On Fri 15-06-18 15:36:07, Jason Baron wrote: >> >> >> On 06/13/2018 03:15 AM, Michal Hocko wrote: >>> On Wed 13-06-18 08:32:19, Vlastimil Babka wrote: > [...] BTW I didn't get why we should allow this for MADV_DONTNEED but not MADV_FREE. Ca

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-20 Thread Michal Hocko
On Fri 15-06-18 15:36:07, Jason Baron wrote: > > > On 06/13/2018 03:15 AM, Michal Hocko wrote: > > On Wed 13-06-18 08:32:19, Vlastimil Babka wrote: [...] > >> BTW I didn't get why we should allow this for MADV_DONTNEED but not > >> MADV_FREE. Can you expand on that? > > > > Well, I wanted to bri

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-15 Thread Jason Baron
On 06/13/2018 03:15 AM, Michal Hocko wrote: > On Wed 13-06-18 08:32:19, Vlastimil Babka wrote: >> On 06/12/2018 04:11 PM, Jason Baron wrote: >>> >>> >>> On 06/12/2018 03:46 AM, Michal Hocko wrote: On Mon 11-06-18 12:23:58, Jason Baron wrote: > On 06/11/2018 11:03 AM, Michal Hocko wrote:

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-15 Thread Jason Baron
On 06/13/2018 05:13 AM, Michal Hocko wrote: > On Tue 12-06-18 10:11:33, Jason Baron wrote: > [...] >> Ok, I share the concern that there is a chance that userspace is relying >> on MADV_DONTNEED not free'ing locked memory. In that case, what if we >> introduce a MADV_DONTNEED_FORCE, which does e

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-13 Thread Michal Hocko
On Tue 12-06-18 10:11:33, Jason Baron wrote: [...] > Ok, I share the concern that there is a chance that userspace is relying > on MADV_DONTNEED not free'ing locked memory. In that case, what if we > introduce a MADV_DONTNEED_FORCE, which does everything that > MADV_DONTNEED currently does but in a

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-13 Thread Michal Hocko
On Wed 13-06-18 09:51:23, Vlastimil Babka wrote: > On 06/13/2018 09:15 AM, Michal Hocko wrote: > > On Wed 13-06-18 08:32:19, Vlastimil Babka wrote: [...] > >> I think more concerning than guaranteeing no later major fault is > >> possible data loss, e.g. replacing data with zero-filled pages. > >

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-13 Thread Vlastimil Babka
On 06/13/2018 09:15 AM, Michal Hocko wrote: > On Wed 13-06-18 08:32:19, Vlastimil Babka wrote: >> On 06/12/2018 04:11 PM, Jason Baron wrote: >>> >>> >>> On 06/12/2018 03:46 AM, Michal Hocko wrote: On Mon 11-06-18 12:23:58, Jason Baron wrote: > On 06/11/2018 11:03 AM, Michal Hocko wrote: >>

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-13 Thread Michal Hocko
On Wed 13-06-18 08:32:19, Vlastimil Babka wrote: > On 06/12/2018 04:11 PM, Jason Baron wrote: > > > > > > On 06/12/2018 03:46 AM, Michal Hocko wrote: > >> On Mon 11-06-18 12:23:58, Jason Baron wrote: > >>> On 06/11/2018 11:03 AM, Michal Hocko wrote: > So can we start discussing whether we wa

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-12 Thread Vlastimil Babka
On 06/12/2018 04:11 PM, Jason Baron wrote: > > > On 06/12/2018 03:46 AM, Michal Hocko wrote: >> On Mon 11-06-18 12:23:58, Jason Baron wrote: >>> On 06/11/2018 11:03 AM, Michal Hocko wrote: So can we start discussing whether we want to allow MADV_DONTNEED on mlocked areas and what downsi

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-12 Thread Jason Baron
On 06/12/2018 03:46 AM, Michal Hocko wrote: > On Mon 11-06-18 12:23:58, Jason Baron wrote: >> On 06/11/2018 11:03 AM, Michal Hocko wrote: >>> So can we start discussing whether we want to allow MADV_DONTNEED on >>> mlocked areas and what downsides it might have? Sure it would turn the >>> strong

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-12 Thread Michal Hocko
On Mon 11-06-18 12:23:58, Jason Baron wrote: > On 06/11/2018 11:03 AM, Michal Hocko wrote: > > So can we start discussing whether we want to allow MADV_DONTNEED on > > mlocked areas and what downsides it might have? Sure it would turn the > > strong mlock guarantee to have the whole vma resident bu

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-11 Thread Jason Baron
On 06/11/2018 11:03 AM, Michal Hocko wrote: > On Mon 11-06-18 10:51:44, Jason Baron wrote: >> On 06/11/2018 03:20 AM, Michal Hocko wrote: >>> [CCing linux-api - please make sure to CC this mailing list anytime you >>> are touching user visible apis] >>> >>> On Fri 08-06-18 14:56:52, Jason Baron

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-11 Thread Jason Baron
On 06/11/2018 03:20 AM, Michal Hocko wrote: > [CCing linux-api - please make sure to CC this mailing list anytime you > are touching user visible apis] > > On Fri 08-06-18 14:56:52, Jason Baron wrote: >> In order to free memory that is marked MLOCK_ONFAULT, the memory region >> needs to be first

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-11 Thread Michal Hocko
On Mon 11-06-18 10:51:44, Jason Baron wrote: > On 06/11/2018 03:20 AM, Michal Hocko wrote: > > [CCing linux-api - please make sure to CC this mailing list anytime you > > are touching user visible apis] > > > > On Fri 08-06-18 14:56:52, Jason Baron wrote: > >> In order to free memory that is mark

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-11 Thread Michal Hocko
[CCing linux-api - please make sure to CC this mailing list anytime you are touching user visible apis] On Fri 08-06-18 14:56:52, Jason Baron 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 reg

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-09 Thread kbuild test robot
Hi Jason, I love your patch! Perhaps something to improve: [auto build test WARNING on mmotm/master] [also build test WARNING on v4.17 next-20180608] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/comm

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-08 Thread Jason Baron
On 06/08/2018 03:57 PM, Andrew Morton wrote: > On Fri, 8 Jun 2018 14:56:52 -0400 Jason Baron 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

Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT

2018-06-08 Thread Andrew Morton
On Fri, 8 Jun 2018 14:56:52 -0400 Jason Baron 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_ON