Re: [PATCH] mm/memory: Replace kmap() with kmap_local_page()

From: Matthew Wilcox
Date: Wed Dec 20 2023 - 15:00:02 EST


On Wed, Dec 20, 2023 at 11:53:34AM -0800, Ira Weiny wrote:
> > My understanding of the current implementation is that unmap_and_put_page()
> > calls folio_release_kmap(), taking as arguments the folio which the page
> > belongs to and the kernel virtual address returned by kmap_local_page().
> >
> > folio_release_kmap() calls kunmap_local() and then folio_put(). The last is
> > called on the folio obtained by the unmap_and_put_page() wrapper and, if I'm
> > not wrong, it releases refcounts on folios like put_page() does on pages.
>
> This is where my consternation came from. I saw the folio_put() and did
> not realize that get_page() now calls folio_get().

That's not new. See 86d234cb0499 which changed get_page() to call
folio_get(), but notice that it's doing the _exact same thing_ that
get_page() used to do. And it's behaved this way since ddc58f27f9ee
in 2016.