On Wed, Sep 29, 2021 at 12:57 PM Peter Xu <peterx@xxxxxxxxxx> wrote: > > Now we have 3 callers of page_maybe_dma_pinned(): > > 1. page_needs_cow_for_dma > 2. pte_is_pinned > 3. shrink_page_list > > The 1st one is good as it takes the seqlock for write properly. The 2nd & 3rd > are missing, we may need to add them. Well, the pte_is_pinned() case at least could do the seqlock in clear_soft_dirty() - it has the vma and mm available. The page shrinker has always been problematic since it doesn't have the vm (and by "always" I mean "modern times" - long ago we used to scan virtually, in the days before rmap) One option might be for fast-gup to give up on locked pages. I think the page lock is the only thing that shrink_page_list() serializes with. Linus