lkml.org 
[lkml]   [2022]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC][PATCH v2 1/5] mm: Avoid unmapping pinned pages
From
On 20.01.22 16:55, Peter Zijlstra wrote:
> Add a guarantee for Anon pages that pin_user_page*() ensures the
> user-mapping of these pages stay preserved. In order to ensure this
> all rmap users have been audited:
>
> vmscan: already fails eviction due to page_maybe_dma_pinned()
>
> migrate: migration will fail on pinned pages due to
> expected_page_refs() not matching, however that is
> *after* try_to_migrate() has already destroyed the
> user mapping of these pages. Add an early exit for
> this case.
>
> numa-balance: as per the above, pinned pages cannot be migrated,
> however numa balancing scanning will happily PROT_NONE
> them to get usage information on these pages. Avoid
> this for pinned pages.

page_maybe_dma_pinned() can race with GUP-fast without
mm->write_protect_seq. This is a real problem for vmscan() with
concurrent GUP-fast as it can result in R/O mappings of pinned pages and
GUP will lose synchronicity to the page table on write faults due to
wrong COW.

If you're just using it as an optimization, that should work just fine.
I assume all migration will freeze the refcount and consequently bail
out at that point. In that case, LGTM.


--
Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2022-01-20 19:25    [W:1.667 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site