linux/mm
Linus Torvalds cd1adf1b63 Revert "mm/gup: remove try_get_page(), call try_get_compound_head() directly"
This reverts commit 9857a17f20.

That commit was completely broken, and I should have caught on to it
earlier.  But happily, the kernel test robot noticed the breakage fairly
quickly.

The breakage is because "try_get_page()" is about avoiding the page
reference count overflow case, but is otherwise the exact same as a
plain "get_page()".

In contrast, "try_get_compound_head()" is an entirely different beast,
and uses __page_cache_add_speculative() because it's not just about the
page reference count, but also about possibly racing with the underlying
page going away.

So all the commentary about how

 "try_get_page() has fallen a little behind in terms of maintenance,
  try_get_compound_head() handles speculative page references more
  thoroughly"

was just completely wrong: yes, try_get_compound_head() handles
speculative page references, but the point is that try_get_page() does
not, and must not.

So there's no lack of maintainance - there are fundamentally different
semantics.

A speculative page reference would be entirely wrong in "get_page()",
and it's entirely wrong in "try_get_page()".  It's not about
speculation, it's purely about "uhhuh, you can't get this page because
you've tried to increment the reference count too much already".

The reason the kernel test robot noticed this bug was that it hit the
VM_BUG_ON() in __page_cache_add_speculative(), which is all about
verifying that the context of any speculative page access is correct.
But since that isn't what try_get_page() is all about, the VM_BUG_ON()
tests things that are not correct to test for try_get_page().

Reported-by: kernel test robot <oliver.sang@intel.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-09-07 11:03:45 -07:00
..
kasan Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
kfence Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
backing-dev.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
balloon_compaction.c
bootmem_info.c mm/bootmem_info.c: mark __init on register_page_bootmem_info_section 2021-09-03 09:58:14 -07:00
cleancache.c
cma_debug.c
cma_sysfs.c
cma.c
cma.h
compaction.c mm: compaction: support triggering of proactive compaction by user 2021-09-03 09:58:17 -07:00
debug_page_ref.c
debug_vm_pgtable.c mm/debug_vm_pgtable: fix corrupted page flag 2021-09-03 09:58:10 -07:00
debug.c
dmapool.c
early_ioremap.c
fadvise.c
failslab.c
filemap.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
frontswap.c
gup_test.c
gup_test.h
gup.c Revert "mm/gup: remove try_get_page(), call try_get_compound_head() directly" 2021-09-07 11:03:45 -07:00
highmem.c
hmm.c
huge_memory.c mm,do_huge_pmd_numa_page: remove unnecessary TLB flushing code 2021-09-03 09:58:13 -07:00
hugetlb_cgroup.c
hugetlb_vmemmap.c
hugetlb_vmemmap.h
hugetlb.c mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY 2021-09-03 09:58:17 -07:00
hwpoison-inject.c mm: hwpoison: don't drop slab caches for offlining non-LRU page 2021-09-03 09:58:15 -07:00
init-mm.c
internal.h mm/numa: automatically generate node migration order 2021-09-03 09:58:16 -07:00
interval_tree.c
io-mapping.c
ioremap.c
Kconfig
Kconfig.debug
khugepaged.c huge tmpfs: SGP_NOALLOC to stop collapse_file() on race 2021-09-03 09:58:12 -07:00
kmemleak.c
ksm.c mm: KSM: fix data type 2021-09-03 09:58:18 -07:00
list_lru.c
maccess.c
madvise.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
Makefile
mapping_dirty_helpers.c
memblock.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
memcontrol.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
memfd.c
memory_hotplug.c mm/migrate: enable returning precise migrate_pages() success count 2021-09-03 09:58:16 -07:00
memory-failure.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
memory.c
mempolicy.c mm/mempolicy.c: use in_task() in mempolicy_slab_node() 2021-09-03 09:58:17 -07:00
mempool.c
memremap.c
memtest.c
migrate.c mm/migrate: correct kernel-doc notation 2021-09-03 09:58:18 -07:00
mincore.c
mlock.c
mm_init.c
mmap_lock.c
mmap.c Merge tag 'denywrite-for-5.15' of git://github.com/davidhildenbrand/linux 2021-09-04 11:35:47 -07:00
mmu_gather.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c mm/mremap: fix memory account on do_munmap() failure 2021-09-03 09:58:14 -07:00
msync.c
nommu.c Merge tag 'denywrite-for-5.15' of git://github.com/davidhildenbrand/linux 2021-09-04 11:35:47 -07:00
oom_kill.c mm: introduce process_mrelease system call 2021-09-03 09:58:17 -07:00
page_alloc.c mm/migrate: enable returning precise migrate_pages() success count 2021-09-03 09:58:16 -07:00
page_counter.c
page_ext.c
page_idle.c
page_io.c
page_isolation.c mm/page_isolation: tracing: trace all test_pages_isolated failures 2021-09-03 09:58:15 -07:00
page_owner.c
page_poison.c
page_reporting.c
page_reporting.h
page_vma_mapped.c
page-writeback.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
pagewalk.c
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c mm/percpu,c: remove obsolete comments of pcpu_chunk_populated() 2021-09-03 09:58:18 -07:00
pgalloc-track.h
pgtable-generic.c
process_vm_access.c
ptdump.c
readahead.c
rmap.c
rodata_test.c
secretmem.c
shmem.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
shuffle.c
shuffle.h
slab_common.c
slab.c
slab.h
slob.c
slub.c
sparse-vmemmap.c
sparse.c mm: introduce memmap_alloc() to unify memory map allocation 2021-09-03 09:58:15 -07:00
swap_cgroup.c
swap_slots.c
swap_state.c
swap.c mm: delete unused get_kernel_page() 2021-09-03 09:58:11 -07:00
swapfile.c mm, memcg: inline swap-related functions to improve disabled memcg config 2021-09-03 09:58:12 -07:00
truncate.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
usercopy.c
userfaultfd.c userfaultfd: change mmap_changing to atomic 2021-09-03 09:58:16 -07:00
util.c mm: don't allow oversized kvmalloc() calls 2021-09-02 09:47:01 -07:00
vmacache.c
vmalloc.c mm/vmalloc: fix wrong behavior in vread 2021-09-03 09:58:14 -07:00
vmpressure.c mm/vmpressure: replace vmpressure_to_css() with vmpressure_to_memcg() 2021-09-03 09:58:17 -07:00
vmscan.c mm, vmscan: guarantee drop_slab_node() termination 2021-09-03 09:58:17 -07:00
vmstat.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
workingset.c
z3fold.c
zbud.c
zpool.c
zsmalloc.c
zswap.c