linux/arch
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
..
alpha Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
arc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
arm Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
arm64 Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
csky Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
h8300 asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
hexagon Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
ia64 Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
m68k Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
microblaze Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
mips Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
nds32 Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
nios2 Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
openrisc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
parisc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
powerpc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
riscv Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
s390 Revert "mm/gup: remove try_get_page(), call try_get_compound_head() directly" 2021-09-07 11:03:45 -07:00
sh Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
sparc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
um Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
x86 Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
xtensa Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
.gitignore
Kconfig Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00