Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting

From: Kirill A. Shutemov
Date: Thu Dec 17 2020 - 05:54:51 EST


On Wed, Dec 16, 2020 at 10:41:36AM -0800, Linus Torvalds wrote:
> On Wed, Dec 16, 2020 at 9:07 AM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:
> >
> > If this looks fine, I'll submit a proper patch.
>
> That patch looks good to me.
>
> It would be good if somebody else looked it through - maybe I like it
> just because I got to pee in the snow and make my mark. But i think
> that filemap_map_pages() now looks a lot more understandable, and
> having that pte_offset_map_lock() outside the loop should be good.

It worth noting that after the change in the worth case scenario we will
have additional ref/unref and lock/unlock of the page if we get deep
enough into filemap_map_pmd(), but fail to map the page.

Also if the range doesn't have a mappable page we would setup a page
table into the PMD entry. It means we cannot have huge page mapped there
later. It may be a bummer: getting the page table out of page table tree
requires mmap_write_lock().

We also take ptl for cold page cache. It may increase ptl contention, but
it should be negligible with split-ptl.

--
Kirill A. Shutemov