linux-yocto/Documentation
Willem de Bruijn 9ef5d4748d bpf: Adjust free target to avoid global starvation of LRU map
[ Upstream commit d4adf1c9ee ]

BPF_MAP_TYPE_LRU_HASH can recycle most recent elements well before the
map is full, due to percpu reservations and force shrink before
neighbor stealing. Once a CPU is unable to borrow from the global map,
it will once steal one elem from a neighbor and after that each time
flush this one element to the global list and immediately recycle it.

Batch value LOCAL_FREE_TARGET (128) will exhaust a 10K element map
with 79 CPUs. CPU 79 will observe this behavior even while its
neighbors hold 78 * 127 + 1 * 15 == 9921 free elements (99%).

CPUs need not be active concurrently. The issue can appear with
affinity migration, e.g., irqbalance. Each CPU can reserve and then
hold onto its 128 elements indefinitely.

Avoid global list exhaustion by limiting aggregate percpu caches to
half of map size, by adjusting LOCAL_FREE_TARGET based on cpu count.
This change has no effect on sufficiently large tables.

Similar to LOCAL_NR_SCANS and lru->nr_scans, introduce a map variable
lru->free_target. The extra field fits in a hole in struct bpf_lru.
The cacheline is already warm where read in the hot path. The field is
only accessed with the lru lock held.

Tested-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://lore.kernel.org/r/20250618215803.3587312-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-07-17 18:37:22 +02:00
..
ABI x86/bugs: Add a Transient Scheduler Attacks mitigation 2025-07-10 16:05:14 +02:00
accel accel/qaic: Add AIC080 support 2024-12-14 20:03:46 +01:00
accounting
admin-guide x86/bugs: Add a Transient Scheduler Attacks mitigation 2025-07-10 16:05:14 +02:00
arch x86/bugs: Rename MDS machinery to something more generic 2025-07-10 16:05:14 +02:00
block
bpf bpf: Adjust free target to avoid global starvation of LRU map 2025-07-17 18:37:22 +02:00
cdrom
core-api module: Provide EXPORT_SYMBOL_GPL_FOR_MODULES() helper 2025-07-10 16:05:08 +02:00
cpu-freq
crypto
dev-tools The core clk framework is left largely untouched this time around except for 2024-09-23 15:01:48 -07:00
devicetree dt-bindings: serial: 8250: Make clocks and clock-frequency exclusive 2025-07-06 11:01:43 +02:00
doc-guide
driver-api serial: mctrl_gpio: split disable_ms into sync and no_sync APIs 2025-05-29 11:02:45 +02:00
fault-injection
fb
features
filesystems fs_parser: update mount_api doc to match function signature 2024-12-05 14:02:29 +01:00
firmware_class
firmware-guide Documentation: ACPI: Use all-string data node references 2025-06-10 07:12:58 -04:00
fpga
gpu drm/xe: Make xe_gt_freq part of the Documentation 2025-06-19 15:32:14 +02:00
hid
hwmon hwmon: (dell-smm) Increment the number of fans 2025-05-29 11:02:22 +02:00
i2c i2c: i801: Add support for Intel Panther Lake 2024-12-14 20:03:55 +01:00
iio docs: iio: ad7380: fix supply for ad7380-4 2024-10-24 18:30:47 +01:00
images
infiniband
input
isdn
kbuild kbuild: rust: add rustc-min-version support function 2025-06-27 11:11:40 +01:00
kernel-hacking
leds - Limited LED current based on thermal conditions in the QCOM flash LED driver. 2024-09-23 14:20:11 -07:00
litmus-tests
livepatch
locking kcsan, seqlock: Support seqcount_latch_t 2024-12-05 14:01:22 +01:00
maintainer
mhi
misc-devices
mm Docs/damon/maintainer-profile: update deprecated awslabs GitHub URLs 2024-10-17 00:28:09 -07:00
netlabel
netlink netlink: specs: tc: replace underscores with dashes in names 2025-07-06 11:01:41 +02:00
networking strparser: Add read_sock callback 2025-02-27 04:30:19 -08:00
nvdimm
nvme
PCI
pcmcia
peci
power Documentation: PM: Clarify pm_runtime_resume_and_get() return value 2024-12-19 18:13:15 +01:00
process soc: fixes for 6.12 2024-10-17 09:43:36 -07:00
RCU doc: rcu: update printed dynticks counter bits 2024-12-05 14:01:19 +01:00
rust rust: remove leftover mentions of the alloc crate 2025-03-22 12:54:23 -07:00
scheduler sched_ext: Documentation: Update instructions for running example schedulers 2024-10-08 08:49:18 -10:00
scsi
security landlock: Fix grammar issues in documentation 2024-10-21 20:36:26 +02:00
sound
sphinx
sphinx-static
spi
staging
target
tee
timers
tools
trace
translations module: Convert default symbol namespace to string literal 2025-02-08 09:57:05 +01:00
usb
userspace-api Landlock fix for v6.12-rc7 2024-11-12 13:01:09 -08:00
virt KVM: x86: Clean up documentation for KVM_X86_QUIRK_SLOT_ZAP_ALL 2024-10-20 07:31:05 -04:00
w1
watchdog [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
wmi platform/x86: msi-wmi-platform: Workaround a ACPI firmware bug 2025-04-25 10:48:04 +02:00
.gitignore
atomic_bitops.txt
atomic_t.txt
Changes
CodingStyle
conf.py
docutils.conf
dontdiff Kbuild updates for v6.12 2024-09-24 13:02:06 -07:00
index.rst
Kconfig
Makefile
memory-barriers.txt
SubmittingPatches
subsystem-apis.rst