Re: [PATCH 1/4] mm: Trial do_wp_page() simplification

From: John Hubbard
Date: Thu Sep 17 2020 - 15:55:42 EST


On 9/17/20 12:42 PM, Linus Torvalds wrote:
On Thu, Sep 17, 2020 at 12:03 PM Peter Xu <peterx@xxxxxxxxxx> wrote:
...

Is there possibly somethign else we can filter on than just
GUP_PIN_COUNTING_BIAS? Because it could be as simple as just marking
the vma itself and saying "this vma has had a page pinning event done
on it".

Because if we only start copying the page *iff* the vma is marked by
that "this vma had page pinning" _and_ the page count is bigger than
GUP_PIN_COUNTING_BIAS, than I think we can rest pretty easily knowing
that we aren't going to hit some regular old-fashioned UNIX server
cases with a lot of forks..

Linus

OK, so this sounds like an improvement that would be desirable in the
core API:

1) Have all the pin_user_pages*() functions reach up and mark the vma(s)
as FOLL_PIN_HAPPENED. I'm assuming that the vma can live it's full life
without the need to ever clear that flag. That *seems* reasonable, based
on the use cases for these kinds of pages.

2) And then rename:

page_maybe_dma_pinned() --> page_likely_dma_pinned()

:)


thanks,
--
John Hubbard
NVIDIA