linux-uconsole/drivers
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
..
accessibility speakup: fix uninitialized flush_lock 2020-12-30 11:53:44 +01:00
acpi Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
amba Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
android ANDROID: Add vendor hook to binder. 2021-03-24 18:13:25 +00:00
ata ata: ahci_brcm: Add back regulators management 2021-03-04 11:37:45 +01:00
atm atm: idt77252: call pci_disable_device() on error path 2021-01-12 20:18:09 +01:00
auxdisplay auxdisplay: ht16k33: Fix refresh rate handling 2021-03-04 11:38:00 +01:00
base Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
bcma
block UPSTREAM: zram: fix broken page writeback 2021-03-16 18:51:46 +00:00
bluetooth This is the 5.10.21 stable release 2021-03-07 12:53:30 +01:00
bus bus: fsl-mc: fix error return code in fsl_mc_object_allocate() 2020-12-30 11:53:46 +01:00
cdrom
char Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
clk Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
clocksource Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
connector
counter counter:ti-eqep: remove floor 2021-01-27 11:55:12 +01:00
cpufreq ANDROID: cpufreq: Export cpu_frequency_limits tracepoint 2021-03-08 13:26:00 +00:00
cpuidle ANDROID: cpuidle: export cpuidle_driver_state_disabled 2021-01-13 02:35:14 +00:00
crypto crypto: sun4i-ss - initialize need_fallback 2021-03-04 11:38:32 +01:00
dax device-dax: Fix default return code of range_parse() 2021-03-04 11:38:15 +01:00
dca
devfreq
dio
dma Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
dma-buf ANDROID: dma-buf: Fix error path on system heaps use of the page pool 2021-03-19 09:04:07 +00:00
edac EDAC/amd64: Do not load on family 0x15, model 0x13 2021-03-07 12:34:08 +01:00
eisa
extcon extcon: max77693: Fix modalias string 2020-12-30 11:53:49 +01:00
firewire
firmware firmware: arm_scmi: Fix call site of scmi_notification_exit 2021-03-04 11:37:23 +01:00
fpga
fsi fsi: Aspeed: Add mutex to protect HW access 2020-12-30 11:53:46 +01:00
gnss
gpio ANDROID: gpiolib: Add vendor hook for gpio read 2021-03-23 11:01:01 +00:00
gpu UPSTREAM: iommu/io-pgtable: Remove tlb_flush_leaf 2021-03-24 12:45:09 -07:00
greybus
hid Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
hsi HSI: Fix PM usage counter unbalance in ssi_hw_init 2021-03-04 11:37:52 +01:00
hv Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind() 2021-03-04 11:37:46 +01:00
hwmon FROMLIST: hwmon: (scmi) port driver to the new scmi_sensor_proto_ops interface 2021-03-02 17:34:33 -08:00
hwspinlock
hwtracing coresight: etm4x: Handle accesses to TRCSTALLCTLR 2021-03-04 11:38:37 +01:00
i2c Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
i3c i3c master: fix missing destroy_workqueue() on error in i3c_master_register 2021-01-06 14:56:53 +01:00
ide ide/falconide: Fix module unload 2021-03-04 11:38:21 +01:00
idle
iio iio: adc: ti_am335x_adc: remove omitted iio_kfifo_free() 2021-01-27 11:55:12 +01:00
infiniband RDMA/rtrs-srv: Do not signal REG_MR 2021-03-07 12:34:06 +01:00
input This is the 5.10.21 stable release 2021-03-07 12:53:30 +01:00
interconnect interconnect: imx8mq: Use icc_sync_state 2021-01-27 11:55:29 +01:00
iommu UPSTREAM: iommu/msm: Hook up iotlb_sync_map 2021-03-24 12:45:16 -07:00
ipack
irqchip Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
isdn misdn: dsp: select CONFIG_BITREVERSE 2021-01-19 18:27:26 +01:00
leds leds: trigger: fix potential deadlock with libata 2021-02-03 23:28:41 +01:00
lightnvm lightnvm: fix memory leak when submit fails 2021-01-27 11:55:22 +01:00
macintosh macintosh/adb-iop: Use big-endian autopoll mask 2021-03-04 11:37:42 +01:00
mailbox mailbox: sprd: correct definition of SPRD_OUTBOX_FIFO_FULL 2021-03-04 11:38:15 +01:00
mcb
md Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
media This is the 5.10.21 stable release 2021-03-07 12:53:30 +01:00
memory UPSTREAM: memory: mtk-smi: Allow building as module 2021-03-24 12:45:16 -07:00
memstick memstick: r592: Fix error return in r592_probe() 2020-12-30 11:53:34 +01:00
message
mfd mfd: gateworks-gsc: Fix interrupt type 2021-03-04 11:38:40 +01:00
misc Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
mmc ANDROID: mmc: support hardware that takes key directly 2021-03-16 21:57:16 +00:00
most
mtd mtd: spi-nor: hisi-sfc: Put child node np on error path 2021-03-04 11:38:37 +01:00
mux
net This is the 5.10.21 stable release 2021-03-07 12:53:30 +01:00
nfc nfc: s3fwrn5: Release the nfc firmware 2020-12-30 11:53:53 +01:00
ntb
nubus
nvdimm libnvdimm/dimm: Avoid race between probe and available_slots_show() 2021-02-10 09:29:17 +01:00
nvme nvme-tcp: add clean action for failed reconnection 2021-03-07 12:34:12 +01:00
nvmem nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer 2021-03-04 11:38:39 +01:00
of Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
opp Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
oprofile
parisc
parport
pci ANDROID: GKI: pci: add Android ABI padding to some structures 2021-03-18 16:02:34 +01:00
pcmcia
perf perf/arm-cmn: Move IRQs when migrating context 2021-03-04 11:37:44 +01:00
phy phy: lantiq: rcu-usb2: wait after clock enable 2021-03-04 11:38:24 +01:00
pinctrl UPSTREAM: pinctrl/meson: enable building as modules 2021-02-11 12:20:51 +00:00
platform Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
pnp
power Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
powercap UPSTREAM: powercap/drivers/dtpm: Add the experimental label to the option description 2021-03-22 15:24:47 +00:00
pps
ps3 powerpc/ps3: use dma_mapping_error() 2020-12-30 11:53:53 +01:00
ptp phy: dp83640: select CONFIG_CRC32 2021-01-17 14:17:02 +01:00
pwm Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
rapidio
ras
regulator Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
remoteproc This is the 5.10.21 stable release 2021-03-07 12:53:30 +01:00
reset FROMLIST: reset: reset-scmi: port driver to the new scmi_reset_proto_ops interface 2021-03-02 17:34:33 -08:00
rpmsg
rtc Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
s390 Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
sbus
scsi ANDROID: vendor_hooks: Add hooks for ufs scheduler 2021-03-18 18:26:18 +00:00
sfi
sh
siox
slimbus slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew() 2020-12-30 11:53:47 +01:00
soc Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
soundwire soundwire: intel: fix possible crash when no device is detected 2021-03-04 11:38:22 +01:00
spi Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
spmi spmi: spmi-pmic-arb: Fix hw_irq overflow 2021-03-04 11:38:40 +01:00
ssb
staging This is the 5.10.21 stable release 2021-03-07 12:53:30 +01:00
target cxgb4/chtls/cxgbit: Keeping the max ofld immediate data size same in cxgb4 and ulds 2021-03-04 11:37:34 +01:00
tc
tee optee: simplify i2c access 2021-03-04 11:37:28 +01:00
thermal ANDROID: thermal: Add logic for filter on-die tz genl event. 2021-03-16 23:42:07 +00:00
thunderbolt thunderbolt: Fix possible NULL pointer dereference in tb_acpi_add_link() 2021-02-10 09:29:15 +01:00
tty This is the 5.10.21 stable release 2021-03-07 12:53:30 +01:00
uio
usb UPSTREAM: usb: dwc3: gadget: Use max speed if unspecified 2021-03-23 16:55:01 +01:00
vdpa vdpa/mlx5: fix param validation in mlx5_vdpa_get_config() 2021-03-04 11:37:17 +01:00
vfio Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
vhost vhost_net: fix ubuf refcount incorrectly when sendmsg fails 2021-01-12 20:18:13 +01:00
video This is the 5.10.21 stable release 2021-03-07 12:53:30 +01:00
virt virt: vbox: Do not use wait_event_interruptible when called from kernel context 2021-03-04 11:37:18 +01:00
virtio FROMGIT: mm, page_poison: use static key more efficiently 2021-03-24 15:09:16 -07:00
visorbus
vlynq
vme
w1 w1: w1_therm: Fix conversion result for negative temperatures 2021-03-04 11:37:18 +01:00
watchdog Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
xen xen-scsiback: don't "handle" error by BUG() 2021-02-23 15:53:24 +01:00
zorro
Kconfig
Makefile