WSL2-Linux-Kernel/mm
Hugh Dickins b109b87050 mm/munlock: replace clear_page_mlock() by final clearance
Placing munlock_vma_page() at the end of page_remove_rmap() shifts most
of the munlocking to clear_page_mlock(), since PageMlocked is typically
still set when mapcount has fallen to 0.  That is not what we want: we
want /proc/vmstat's unevictable_pgs_cleared to remain as a useful check
on the integrity of of the mlock/munlock protocol - small numbers are
not surprising, but big numbers mean the protocol is not working.

That could be easily fixed by placing munlock_vma_page() at the start of
page_remove_rmap(); but later in the series we shall want to batch the
munlocking, and that too would tend to leave PageMlocked still set at
the point when it is checked.

So delete clear_page_mlock() now: leave it instead to release_pages()
(and __page_cache_release()) to do this backstop clearing of Mlocked,
when page refcount has fallen to 0.  If a pinned page occasionally gets
counted as Mlocked and Unevictable until it is unpinned, that's okay.

A slightly regrettable side-effect of this change is that, since
release_pages() and __page_cache_release() may be called at interrupt
time, those places which update NR_MLOCK with interrupts enabled
had better use mod_zone_page_state() than __mod_zone_page_state()
(but holding the lruvec lock always has interrupts disabled).

This change, forcing Mlocked off when refcount 0 instead of earlier
when mapcount 0, is not fundamental: it can be reversed if performance
or something else is found to suffer; but this is the easiest way to
separate the stats - let's not complicate that without good reason.

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
2022-02-17 11:56:53 -05:00
..
damon
kasan
kfence kfence: make test case compatible with run time set sample interval 2022-02-11 17:55:00 -08:00
Kconfig
Kconfig.debug
Makefile
backing-dev.c
balloon_compaction.c
bootmem_info.c
cma.c
cma.h
cma_debug.c
cma_sysfs.c
compaction.c
debug.c
debug_page_ref.c
debug_vm_pgtable.c
dmapool.c
early_ioremap.c
fadvise.c
failslab.c
filemap.c
folio-compat.c
frontswap.c
gup.c mm/munlock: delete FOLL_MLOCK and FOLL_POPULATE 2022-02-17 11:56:36 -05:00
gup_test.c
gup_test.h
highmem.c
hmm.c
huge_memory.c mm/munlock: rmap call mlock_vma_page() munlock_vma_page() 2022-02-17 11:56:48 -05:00
hugetlb.c mm/munlock: rmap call mlock_vma_page() munlock_vma_page() 2022-02-17 11:56:48 -05:00
hugetlb_cgroup.c
hugetlb_vmemmap.c
hugetlb_vmemmap.h
hwpoison-inject.c
init-mm.c
internal.h mm/munlock: replace clear_page_mlock() by final clearance 2022-02-17 11:56:53 -05:00
interval_tree.c
io-mapping.c
ioremap.c
khugepaged.c mm/munlock: rmap call mlock_vma_page() munlock_vma_page() 2022-02-17 11:56:48 -05:00
kmemleak.c
ksm.c mm/munlock: rmap call mlock_vma_page() munlock_vma_page() 2022-02-17 11:56:48 -05:00
list_lru.c
maccess.c
madvise.c mm/munlock: delete munlock_vma_pages_all(), allow oomreap 2022-02-17 11:56:44 -05:00
mapping_dirty_helpers.c
memblock.c
memcontrol.c
memfd.c
memory-failure.c
memory.c mm/munlock: rmap call mlock_vma_page() munlock_vma_page() 2022-02-17 11:56:48 -05:00
memory_hotplug.c
mempolicy.c
mempool.c
memremap.c
memtest.c
migrate.c mm/munlock: rmap call mlock_vma_page() munlock_vma_page() 2022-02-17 11:56:48 -05:00
mincore.c
mlock.c mm/munlock: replace clear_page_mlock() by final clearance 2022-02-17 11:56:53 -05:00
mm_init.c
mmap.c mm/munlock: delete munlock_vma_pages_all(), allow oomreap 2022-02-17 11:56:44 -05:00
mmap_lock.c
mmu_gather.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nommu.c
oom_kill.c mm/munlock: delete munlock_vma_pages_all(), allow oomreap 2022-02-17 11:56:44 -05:00
page-writeback.c
page_alloc.c
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
page_vma_mapped.c
pagewalk.c
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 mm/munlock: replace clear_page_mlock() by final clearance 2022-02-17 11:56:53 -05:00
rodata_test.c
secretmem.c
shmem.c
shuffle.c
shuffle.h
slab.c
slab.h
slab_common.c
slob.c
slub.c
sparse-vmemmap.c
sparse.c
swap.c mm/munlock: replace clear_page_mlock() by final clearance 2022-02-17 11:56:53 -05:00
swap_cgroup.c
swap_slots.c
swap_state.c
swapfile.c
truncate.c
usercopy.c
userfaultfd.c mm/munlock: rmap call mlock_vma_page() munlock_vma_page() 2022-02-17 11:56:48 -05:00
util.c
vmacache.c
vmalloc.c
vmpressure.c
vmscan.c
vmstat.c
workingset.c
z3fold.c
zbud.c
zpool.c
zsmalloc.c
zswap.c