Re: Ack to merge through DRM? WAS Re: [PATCH v2 1/5] mm: Add write-protect and clean utilities for address space ranges

From: Kirill A. Shutemov
Date: Mon Sep 30 2019 - 09:04:01 EST


On Fri, Sep 27, 2019 at 09:39:48AM -0700, Linus Torvalds wrote:
> On Fri, Sep 27, 2019 at 5:17 AM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:
> >
> > > Call it "walk_page_mapping()". And talk extensively about how the
> > > locking differs a lot from the usual "walk_page_vma()" things.
> >
> > Walking mappings of a page is what rmap does. This code thas to be
> > integrated there.
>
> Well, that's very questionable.
>
> The rmap code mainly does the "page -> virtual" mapping. One page at a time.
>
> The page walker code does the "virtual -> pte" mapping. Always a whole
> range at a time.

Have you seen page_vma_mapped_walk()? I made it specifically for rmap code
to cover cases when a THP is mapped with PTEs. To me it's not a big
stretch to make it cover multiple pages too.

> So I think conceptually, mm/memory.c and unmap_mapping_range() is
> closest but I don't think it's practical to share code.
>
> And between mm/pagewalk.c and mm/rmap.c, I think the page walking has
> way more of actual practical code sharing, and is also conceptually
> closer because most of the code is about walking a range, not looking
> up the mapping of one page.

I guess it's matter of personal preferences, but page table walkers based
on callback always felt wrong to me.

--
Kirill A. Shutemov