linux-uconsole/include
Vlastimil Babka e871c7feeb FROMGIT: mm, page_poison: use static key more efficiently
Commit 11c9c7edae ("mm/page_poison.c: replace bool variable with static
key") changed page_poisoning_enabled() to a static key check.  However,
the function is not inlined, so each check still involves a function call
with overhead not eliminated when page poisoning is disabled.

Analogically to how debug_pagealloc is handled, this patch converts
page_poisoning_enabled() back to boolean check, and introduces
page_poisoning_enabled_static() for fast paths.  Both functions are
inlined.

The function kernel_poison_pages() is also called unconditionally and does
the static key check inside.  Remove it from there and put it to callers.
Also split it to two functions kernel_poison_pages() and
kernel_unpoison_pages() instead of the confusing bool parameter.

Also optimize the check that enables page poisoning instead of
debug_pagealloc for architectures without proper debug_pagealloc support.
Move the check to init_mem_debugging_and_hardening() to enable a single
static key instead of having two static branches in
page_poisoning_enabled_static().

Link: https://lkml.kernel.org/r/20201113104033.22907-3-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Laura Abbott <labbott@kernel.org>
Cc: Mateusz Nosek <mateusznosek0@gmail.com>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit 8db26a3d47
 https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm)
Bug: 182930667
Signed-off-by: Alexander Potapenko <glider@google.com>
Change-Id: Ifc3fdf5cd58f3b8346bf81480df3836811e7458b
2021-03-24 15:09:16 -07:00
..
acpi ACPICA: Fix exception code class checks 2021-03-04 11:37:24 +01:00
asm-generic ANDROID: vmlinux.lds.h: Define SANITIZER_DISCARDS with CONFIG_CFI_CLANG 2021-03-19 14:32:06 +00:00
clocksource
crypto UPSTREAM: crypto: blake2b - sync with blake2s implementation 2021-02-23 08:06:20 +01:00
drm This is the 5.10.15 stable release 2021-02-10 09:53:50 +01:00
dt-bindings UPSTREAM: dt-bindings: mediatek: Add binding for mt8192 IOMMU 2021-03-24 12:45:11 -07:00
keys
kunit
kvm FROMGIT: KVM: arm64: Turn kvm_arm_support_pmu_v3() into a static key 2021-03-05 16:45:13 +00:00
linux FROMGIT: mm, page_poison: use static key more efficiently 2021-03-24 15:09:16 -07:00
math-emu
media Merge 5.10.4 into android12-5.10 2020-12-30 12:47:03 +01:00
memory
misc
net ANDROID: GKI: sock.h: add Android ABI padding to some structures 2021-03-22 15:05:31 +00:00
pcmcia
ras
rdma RDMA: Lift ibdev_to_node from rds to common code 2021-02-26 10:12:59 +01:00
scsi
soc UPSTREAM: memory: mtk-smi: Allow building as module 2021-03-24 12:45:16 -07:00
sound
target
trace ANDROID: Add vendor hook to binder. 2021-03-24 18:13:25 +00:00
uapi FROMGIT: binder: BINDER_GET_FROZEN_INFO ioctl 2021-03-24 14:53:36 +00:00
vdso
video
xen Xen/gntdev: correct error checking in gntdev_map_grant_pages() 2021-02-23 15:53:24 +01:00