WSL2-Linux-Kernel/mm
Peter Xu d042035eaf mm/thp: Split huge pmds/puds if they're pinned when fork()
Pinned pages shouldn't be write-protected when fork() happens, because
follow up copy-on-write on these pages could cause the pinned pages to
be replaced by random newly allocated pages.

For huge PMDs, we split the huge pmd if pinning is detected.  So that
future handling will be done by the PTE level (with our latest changes,
each of the small pages will be copied).  We can achieve this by let
copy_huge_pmd() return -EAGAIN for pinned pages, so that we'll
fallthrough in copy_pmd_range() and finally land the next
copy_pte_range() call.

Huge PUDs will be even more special - so far it does not support
anonymous pages.  But it can actually be done the same as the huge PMDs
even if the split huge PUDs means to erase the PUD entries.  It'll
guarantee the follow up fault ins will remap the same pages in either
parent/child later.

This might not be the most efficient way, but it should be easy and
clean enough.  It should be fine, since we're tackling with a very rare
case just to make sure userspaces that pinned some thps will still work
even without MADV_DONTFORK and after they fork()ed.

Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-09-27 11:21:35 -07:00
..
kasan
Kconfig
Kconfig.debug
Makefile
backing-dev.c
balloon_compaction.c
cleancache.c
cma.c
cma.h
cma_debug.c
compaction.c
debug.c
debug_page_ref.c
debug_vm_pgtable.c
dmapool.c
early_ioremap.c
fadvise.c
failslab.c
filemap.c mm: fix wake_page_function() comment typos 2020-09-20 10:38:47 -07:00
frame_vector.c
frontswap.c
gup.c mm: Introduce mm_struct.has_pinned 2020-09-27 11:21:35 -07:00
gup_benchmark.c
highmem.c
hmm.c
huge_memory.c mm/thp: Split huge pmds/puds if they're pinned when fork() 2020-09-27 11:21:35 -07:00
hugetlb.c mm/hugetlb: fix a race between hugetlb sysctl handlers 2020-09-05 12:14:30 -07:00
hugetlb_cgroup.c
hwpoison-inject.c
init-mm.c
internal.h
interval_tree.c
ioremap.c
khugepaged.c mm/khugepaged.c: fix khugepaged's request size in collapse_file 2020-09-05 12:14:30 -07:00
kmemleak-test.c
kmemleak.c
ksm.c ksm: reinstate memcg charge on copied pages 2020-09-19 13:13:38 -07:00
list_lru.c
maccess.c
madvise.c mm: validate pmd after splitting 2020-09-26 10:48:08 -07:00
mapping_dirty_helpers.c
memblock.c
memcontrol.c mm: memcontrol: fix missing suffix of workingset_restore 2020-09-26 10:33:57 -07:00
memfd.c
memory-failure.c
memory.c mm: Do early cow for pinned pages during fork() for ptes 2020-09-27 11:21:35 -07:00
memory_hotplug.c mm: don't rely on system state to detect hot-plug operations 2020-09-26 10:33:57 -07:00
mempolicy.c
mempool.c
memremap.c
memtest.c
migrate.c mm/migrate: correct thp migration stats 2020-09-26 10:33:57 -07:00
mincore.c
mlock.c mlock: fix unevictable_pgs event counts on THP 2020-09-19 13:13:38 -07:00
mm_init.c
mmap.c
mmu_gather.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nommu.c
oom_kill.c
page-writeback.c
page_alloc.c mm: replace memmap_context by meminit_context 2020-09-26 10:33:57 -07:00
page_counter.c
page_ext.c
page_idle.c
page_io.c
page_isolation.c mm/memory_hotplug: drain per-cpu pages again during memory offline 2020-09-19 13:13:39 -07:00
page_owner.c
page_poison.c
page_reporting.c
page_reporting.h
page_vma_mapped.c
pagewalk.c
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c percpu: fix first chunk size calculation for populated bitmap 2020-09-17 17:34:39 +00:00
pgalloc-track.h
pgtable-generic.c
process_vm_access.c
ptdump.c
readahead.c
rmap.c mm/rmap: fixup copying of soft dirty and uffd ptes 2020-09-05 12:14:30 -07:00
rodata_test.c
shmem.c tmpfs: restore functionality of nr_inodes=0 2020-09-19 13:13:38 -07:00
shuffle.c
shuffle.h
slab.c mm: slab: fix potential double free in ___cache_free 2020-09-26 10:15:01 -07:00
slab.h
slab_common.c
slob.c
slub.c mm: slub: fix conversion of freelist_corrupted() 2020-09-05 12:14:29 -07:00
sparse-vmemmap.c
sparse.c
swap.c mlock: fix unevictable_pgs event counts on THP 2020-09-19 13:13:38 -07:00
swap_cgroup.c
swap_slots.c
swap_state.c
swapfile.c mm, THP, swap: fix allocating cluster for swapfile by mistake 2020-09-26 10:33:57 -07:00
truncate.c
usercopy.c
userfaultfd.c
util.c
vmacache.c
vmalloc.c
vmpressure.c
vmscan.c mm: fix check_move_unevictable_pages() on THP 2020-09-19 13:13:38 -07:00
vmstat.c Merge branch 'simplify-do_wp_page' 2020-09-04 09:31:54 -07:00
workingset.c
z3fold.c
zbud.c
zpool.c
zsmalloc.c
zswap.c