Re: [PATCH] mm: split thp synchronously on MADV_DONTNEED

From: Peter Xu
Date: Thu Nov 25 2021 - 05:11:31 EST


On Tue, Nov 23, 2021 at 09:28:34AM -0800, Shakeel Butt wrote:
> On Tue, Nov 23, 2021 at 9:26 AM David Hildenbrand <david@xxxxxxxxxx> wrote:
> >
> > On 23.11.21 18:24, Shakeel Butt wrote:
> > > On Tue, Nov 23, 2021 at 9:20 AM David Hildenbrand <david@xxxxxxxxxx> wrote:
> > >>
> > >> On 23.11.21 18:17, Shakeel Butt wrote:
> > >>> On Tue, Nov 23, 2021 at 8:57 AM David Hildenbrand <david@xxxxxxxxxx> wrote:
> > >>>>
> > >>> [...]
> > >>>>>>
> > >>>>>> I do wonder which these locking contexts are exactly, and if we could
> > >>>>>> also do the same thing on ordinary munmap -- because I assume it can be
> > >>>>>> similarly problematic for some applications.
> > >>>>>
> > >>>>> This is a good question regarding munmap. One main difference is
> > >>>>> munmap takes mmap_lock in write mode and usually performance critical
> > >>>>> applications avoid such operations.
> > >>>>
> > >>>> Maybe we can extend it too most page zapping, if that makes things simpler.
> > >>>>
> > >>>
> > >>> Do you mean doing sync THP split for most of page zapping functions
> > >>> (but only if that makes things simpler)?
> > >>>
> > >>
> > >> Yes -- if there are no downsides.
> > >>
> > >
> > > I will try. At the moment the assumption of "Not null zap_details
> > > implies leave swap entries" is giving me a headache.
> >
> > Not only you, did you stumble over
> >
> > https://lkml.kernel.org/r/20211115134951.85286-1-peterx@xxxxxxxxxx

(thanks for raising this, David)

> >
> > already?
> >
>
> Oh thanks for the pointer. I missed that. I will take a look. Thanks again.

Hi, Shakeel,

I saw your v2 has started to pass in zap_details, then we need know the side
effect on that skip-swap-entry thing because with your v2 code munmap() will
start to skip swap entry too (while it was not before).

I saw that you didn't mention this in v2 patch either in commit message or
code, not sure whether you digged that up. I think it needs some double check
(or feel free to start this digging by reviewing my small patch above :).

Thanks,

--
Peter Xu