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

Linus Torvalds torvalds at linux-foundation.org
Fri Sep 27 16:39:48 UTC 2019


On Fri, Sep 27, 2019 at 5:17 AM Kirill A. Shutemov <kirill at shutemov.name> 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.

The new code wants a combination of both.

It very much is about walking ranges - as in mm/pagewalk.c. It's just
that it walks potentially multiple ranges, based on where the address
space is mapped.

I think it has way more commonalities with the page walking code than
it has with the rmap code. But yes, there is some of that "look up
mappings based on address space" in there too, but it's the least part
of it

And as Thomas pointed out, it also has commonalities with
unmap_mapping_pages() in mm/memory.c. In many ways that part is the
closest.

I'd say that from a code sharing standpoint, mm/rmap.c is absolutely
the wrong place. It's the furthest away from what Thomas wants to do.

The mm/pagewalk.c code has the most actual code that could be shared,
and the addition would be smallest there.

And conceptually the closest analogue in terms of what it _does_ is
unmap_mapping_range() in mm/memory.c, but I see no room for sharing
actual code there unless we completely change how we do
zap_page_range() and add a lot of configurability there (which we
don't want, because page table teardown at exit is really a pretty
critical operation - I commonly see copy_page_range() and
zap_page_range() on profiles if you have things like script-heavyu
traditional UNIX loads).

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.

               Linus


More information about the dri-devel mailing list