Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707840

Re: [PATCH] mm/rmap: try_to_unmap_one() do not call mmu_notifier under ptl

From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mm/rmap: try_to_unmap_one() do not call mmu_notifier under ptl
Date 2017-08-09 22:20 +0200
Message-ID <ucFCq-3KK-31@gated-at.bofh.it> (permalink)
References <ucBS9-1ep-1@gated-at.bofh.it> <ucCbw-1mZ-25@gated-at.bofh.it> <ucCuU-1ua-55@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 9 Aug 2017 12:52:46 -0400 (EDT) Jerome Glisse <jglisse@redhat.com> wrote:

> > On Wed, Aug 09, 2017 at 12:17:09PM -0400, jglisse@redhat.com wrote:
> > > From: J__r__me Glisse <jglisse@redhat.com>
> > > 
> > > MMU notifiers can sleep, but in try_to_unmap_one() we call
> > > mmu_notifier_invalidate_page() under page table lock.
> > > 
> > > Let's instead use mmu_notifier_invalidate_range() outside
> > > page_vma_mapped_walk() loop.
> > > 
> > > Signed-off-by: J__r__me Glisse <jglisse@redhat.com>
> > > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > Cc: Andrew Morton <akpm@linux-foundation.org>
> > > Fixes: c7ab0d2fdc84 ("mm: convert try_to_unmap_one() to use
> > > page_vma_mapped_walk()")
> > > ---
> > >  mm/rmap.c | 36 +++++++++++++++++++++---------------
> > >  1 file changed, 21 insertions(+), 15 deletions(-)
> > > 
> > > diff --git a/mm/rmap.c b/mm/rmap.c
> > > index aff607d5f7d2..d60e887f1cda 100644
> > > --- a/mm/rmap.c
> > > +++ b/mm/rmap.c
> > > @@ -1329,7 +1329,8 @@ static bool try_to_unmap_one(struct page *page,
> > > struct vm_area_struct *vma,
> > >  	};
> > >  	pte_t pteval;
> > >  	struct page *subpage;
> > > -	bool ret = true;
> > > +	bool ret = true, invalidation_needed = false;
> > > +	unsigned long end = address + PAGE_SIZE;
> > 
> > I think it should be 'address + (1UL << compound_order(page))'.
> 
> Can't address point to something else than first page in huge page ?
> Also i did use end as an optimization ie maybe not all the pte in the
> range are valid and thus they not all need to be invalidated hence by
> tracking the last one that needs invalidation i am limiting the range.
> 
> But it is a small optimization so i am not attach to it.
> 

So we need this patch in addition to Kirrill's "rmap: do not call
mmu_notifier_invalidate_page() under ptl". 

Jerome, I'm seeing a bunch of rejects applying this patch to current
mainline.  It's unclear which kernel you're patching but we'll need
something which can go into Linus soon and which is backportable (with
mimimal fixups) into -stable kernels, please.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm/rmap: try_to_unmap_one() do not call mmu_notifier under ptl jglisse@redhat.com - 2017-08-09 18:20 +0200
  Re: [PATCH] mm/rmap: try_to_unmap_one() do not call mmu_notifier  under ptl "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-08-09 18:40 +0200
    Re: [PATCH] mm/rmap: try_to_unmap_one() do not call mmu_notifier  under ptl Jerome Glisse <jglisse@redhat.com> - 2017-08-09 19:00 +0200
      Re: [PATCH] mm/rmap: try_to_unmap_one() do not call mmu_notifier  under ptl Andrew Morton <akpm@linux-foundation.org> - 2017-08-09 22:20 +0200
        Re: [PATCH] mm/rmap: try_to_unmap_one() do not call mmu_notifier  under ptl Jerome Glisse <jglisse@redhat.com> - 2017-08-09 22:50 +0200

csiph-web