linux-stable/mm
Suren Baghdasaryan 49b0638502 mm: enable page walking API to lock vmas during the walk
walk_page_range() and friends often operate under write-locked mmap_lock. 
With introduction of vma locks, the vmas have to be locked as well during
such walks to prevent concurrent page faults in these areas.  Add an
additional member to mm_walk_ops to indicate locking requirements for the
walk.

The change ensures that page walks which prevent concurrent page faults
by write-locking mmap_lock, operate correctly after introduction of
per-vma locks.  With per-vma locks page faults can be handled under vma
lock without taking mmap_lock at all, so write locking mmap_lock would
not stop them.  The change ensures vmas are properly locked during such
walks.

A sample issue this solves is do_mbind() performing queue_pages_range()
to queue pages for migration.  Without this change a concurrent page
can be faulted into the area and be left out of migration.

Link: https://lkml.kernel.org/r/20230804152724.3090321-2-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
Suggested-by: Jann Horn <jannh@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Laurent Dufour <ldufour@linux.ibm.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michel Lespinasse <michel@lespinasse.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-08-21 13:07:20 -07:00
..
damon mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
kasan kasan, slub: fix HW_TAGS zeroing with slub_debug 2023-07-08 09:29:32 -07:00
kfence
kmsan
Kconfig mm: disable CONFIG_PER_VMA_LOCK until its fixed 2023-07-08 09:29:29 -07:00
Kconfig.debug
Makefile
backing-dev.c
balloon_compaction.c
bootmem_info.c
cma.c
cma.h
cma_debug.c
cma_sysfs.c
compaction.c mm: compaction: fix endless looping over same migrate block 2023-08-04 13:03:42 -07:00
debug.c
debug_page_alloc.c
debug_page_ref.c
debug_vm_pgtable.c
dmapool.c
dmapool_test.c
early_ioremap.c
fadvise.c
fail_page_alloc.c
failslab.c
filemap.c - Yosry Ahmed brought back some cgroup v1 stats in OOM logs. 2023-06-28 10:28:11 -07:00
folio-compat.c
frontswap.c
gup.c mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT 2023-08-21 13:07:20 -07:00
gup_test.c
gup_test.h
highmem.c
hmm.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
huge_memory.c mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT 2023-08-21 13:07:20 -07:00
hugetlb.c hugetlb: do not clear hugetlb dtor until allocating vmemmap 2023-08-04 13:03:41 -07:00
hugetlb_cgroup.c
hugetlb_vmemmap.c
hugetlb_vmemmap.h
hwpoison-inject.c
init-mm.c
internal.h smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd() 2023-08-21 13:07:20 -07:00
interval_tree.c
io-mapping.c
ioremap.c
khugepaged.c mm/khugepaged: fix regression in collapse_file() 2023-06-29 09:41:45 -07:00
kmemleak.c
ksm.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
list_lru.c
maccess.c
madvise.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
mapping_dirty_helpers.c
memblock.c Revert "mm,memblock: reset memblock.reserved to system init state to prevent UAF" 2023-07-28 09:47:06 -07:00
memcontrol.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
memfd.c
memory-failure.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
memory-tiers.c
memory.c mm: lock_vma_under_rcu() must check vma->anon_vma under vma lock 2023-07-27 11:13:22 -07:00
memory_hotplug.c
mempolicy.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
mempool.c
memremap.c
memtest.c
migrate.c
migrate_device.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
mincore.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
mlock.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
mm_init.c - Yosry Ahmed brought back some cgroup v1 stats in OOM logs. 2023-06-28 10:28:11 -07:00
mm_slot.h
mmap.c mm: lock VMA in dup_anon_vma() before setting ->anon_vma 2023-07-27 13:07:04 -07:00
mmap_lock.c
mmu_gather.c
mmu_notifier.c
mmzone.c
mprotect.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
mremap.c mm: Update do_vmi_align_munmap() return semantics 2023-07-01 08:10:56 -07:00
msync.c
nommu.c xtensa: fix lock_mm_and_find_vma in case VMA not found 2023-07-01 08:00:05 -07:00
oom_kill.c
page-writeback.c writeback: account the number of pages written back 2023-07-08 09:29:30 -07:00
page_alloc.c - Yosry Ahmed brought back some cgroup v1 stats in OOM logs. 2023-06-28 10:28:11 -07:00
page_counter.c
page_ext.c
page_idle.c
page_io.c
page_isolation.c
page_owner.c
page_poison.c
page_reporting.c
page_reporting.h
page_table_check.c - Yosry Ahmed brought back some cgroup v1 stats in OOM logs. 2023-06-28 10:28:11 -07:00
page_vma_mapped.c
pagewalk.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c
pgalloc-track.h
pgtable-generic.c
process_vm_access.c
ptdump.c
readahead.c
rmap.c
rodata_test.c
secretmem.c
shmem.c shmem: minor fixes to splice-read implementation 2023-07-27 13:07:03 -07:00
show_mem.c
shrinker_debug.c
shuffle.c
shuffle.h
slab.c slab updates for 6.5 2023-06-29 16:34:12 -07:00
slab.h kasan, slub: fix HW_TAGS zeroing with slub_debug 2023-07-08 09:29:32 -07:00
slab_common.c slab updates for 6.5 2023-06-29 16:34:12 -07:00
slub.c slab updates for 6.5 2023-06-29 16:34:12 -07:00
sparse-vmemmap.c
sparse.c - Arnd Bergmann has fixed a bunch of -Wmissing-prototypes in 2023-06-28 10:59:38 -07:00
swap.c
swap.h
swap_cgroup.c
swap_slots.c
swap_state.c
swapfile.c mm/swapfile: fix wrong swap entry type for hwpoisoned swapcache page 2023-08-04 13:03:40 -07:00
truncate.c
usercopy.c
userfaultfd.c
util.c
vmalloc.c
vmpressure.c
vmscan.c mm: enable page walking API to lock vmas during the walk 2023-08-21 13:07:20 -07:00
vmstat.c - Yosry Ahmed brought back some cgroup v1 stats in OOM logs. 2023-06-28 10:28:11 -07:00
workingset.c
z3fold.c
zbud.c
zpool.c
zsmalloc.c zsmalloc: fix races between modifications of fullness and isolated 2023-08-04 13:03:40 -07:00
zswap.c