Re: [PATCH] mm, zone_device: replace {get, put}_zone_device_page() with a single reference

From: Ingo Molnar
Date: Fri Apr 28 2017 - 02:39:28 EST



* Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:

> On Wed, Apr 26, 2017 at 05:55:31PM -0700, Dan Williams wrote:
> > Kirill points out that the calls to {get,put}_dev_pagemap() can be
> > removed from the mm fast path if we take a single get_dev_pagemap()
> > reference to signify that the page is alive and use the final put of the
> > page to drop that reference.
> >
> > This does require some care to make sure that any waits for the
> > percpu_ref to drop to zero occur *after* devm_memremap_page_release(),
> > since it now maintains its own elevated reference.
> >
> > Cc Ingo Molnar <mingo@xxxxxxxxxx>
> > Cc: Jérôme Glisse <jglisse@xxxxxxxxxx>
> > Cc: Logan Gunthorpe <logang@xxxxxxxxxxxx>
> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > Suggested-by: Kirill Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> > Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
> > ---
> >
> > This patch might fix the regression that we found with the conversion to
> > generic get_user_pages_fast() in the x86/mm branch pending for 4.12
> > (commit 2947ba054a4d "x86/mm/gup: Switch GUP to the generic
> > get_user_page_fast() implementation"). I'll test tomorrow, but in case
> > someone can give it a try before I wake up, here's an early version.
>
> + Ingo.
>
> This works for me with and without GUP revert.
>
> Tested-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
>
> > drivers/dax/pmem.c | 2 +-
> > drivers/nvdimm/pmem.c | 13 +++++++++++--
>
> There's a trivial conflict in drivers/nvdimm/pmem.c when applied to
> tip/master.

Ok, could someone please send a version either to Linus for v4.11, or a version
against latest -tip so I can included it in x86/mm, so that x86/mm gets unbroken.

Thanks,

Ingo