> When performing mlock() or munlock() otherwise normal VMAs have VMA_IO_BIT > solely to fix a race with migration which might otherwise double-count > mlock VMAs. > > This is unnecessary - at the point of applying folio mlock state, whether > setting or clearing PG_mlocked, we know whether or not we are locking. > > Solve this in two ways - thread a boolean through the page table walk > indicating whether a lock or unlock is being performed, and run a locking > walk with VMA_LOCKONFAULT_BIT set and VMA_LOCKED_BIT cleared. > > This state never occurs otherwise, as VMA_LOCKONFAULT_BIT always implies > VMA_LOCKED_BIT. These are also always cleared together. > > Then, update folio_add_lru_vma() and mlock_folio() to check only for > [ ... ] > > While here, also replace some deprecated VMA flag predicates. > > Reviewed-by: Zi Yan <[email protected]> > Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/20261003-b4-mmap-prepare-vma-flag-sanify-v4-0-a1f052500...@kernel.org?part=23
