linux/Documentation
Yiwei Lin cd047867ee rbtree: Update augmented data on the way down in rb_add_augmented_cached()
rb_add_augmented_cached() links the new node and then calls
->propagate() from the parent up to the root to bring the augmented
data of the ancestors up to date.  It marks that as "suboptimal": every
augmented user that open-codes its insertion (interval trees, vmalloc,
drm_mm, gpu buddy, ...) instead folds the new node's value into each
ancestor while walking down, which touches no sibling and needs no
second pass.  ->propagate() has to read both children of every
ancestor until it finds one whose value did not change.

Add a ->merge() callback to struct rb_augment_callbacks that folds the
augmented data of a node being inserted into one of its future
ancestors, and use it on the descent.  RB_DECLARE_CALLBACKS() derives
it from the RB_AUG() list, so every user of the template gets it for
free, and sched/eevdf, the only caller of the helper, needs no change.

The new node's augmented data must describe the node alone before the
call.  That was already required, since ->propagate() read it, and
sched/eevdf sets it up that way.

Measured with rbtree_test's cached augmented test switched to
rb_add_augmented_cached() (next patch), nnodes cached insert+delete,
median of 5 runs, for reference also the open-coded descent used by
augmented test 1.  Raspberry Pi 4 Model B (Cortex-A72, 1.8 GHz), arch
timer ticks (54 MHz):

    nnodes    open-coded      before       after
       100           459         500         442  (-11.6%)
     10000        182046      186144      180208   (-3.2%)
    100000       5533679     5711647     5579444   (-2.3%)

x86-64 KVM guest (Intel i7-13800H), cycles:

    nnodes    open-coded      before       after
       100          7657        7622        7059   (-7.4%)
     10000       4738075     5075847     4627462   (-8.8%)
    100000      75618429    79840335    71324700  (-10.7%)

The other rbtree_test numbers are unchanged and the augmented invariant
checks still pass on both.

Signed-off-by: Yiwei Lin <s921975628@gmail.com>
Assisted-by: LLM
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20261005093236.62702-4-s921975628@gmail.com
2026-10-13 13:51:27 +02:00
..
ABI Merge branch 'tip/sched/urgent' 2026-10-13 13:51:24 +02:00
accel
accounting
admin-guide Merge branch 'tip/sched/urgent' 2026-10-13 13:51:24 +02:00
arch arm64 fixes for -rc4 2026-09-18 09:28:30 -07:00
block A handful of late-arriving fixes, a Japanese translation that was ready 2026-08-26 09:25:12 -07:00
bpf bpf, arm64: Convert struct_ops arena arguments in the trampoline 2026-08-14 05:55:02 +02:00
cdrom
core-api rbtree: Update augmented data on the way down in rb_add_augmented_cached() 2026-10-13 13:51:27 +02:00
cpu-freq
crypto This update includes the following changes: 2026-08-19 17:25:42 -07:00
dev-tools mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
devicetree Input updates for v7.3-rc3 2026-09-20 07:02:34 -07:00
doc-guide
driver-api virt: Introduce steal governor driver 2026-09-28 08:44:43 +02:00
edac
fault-injection nvme: add opcode filtering for fault injection 2026-08-19 07:51:23 -07:00
fb
features
filesystems A wide variety of mostly CephFS fixes and cleanups, split between 2026-08-28 11:51:05 -07:00
firmware_class
firmware-guide
fpga
gpu DRM Rust changes for v7.3-rc1 2026-08-10 14:48:11 +10:00
hid HID: add documentation and Coccinelle script for FF registration race 2026-08-14 14:46:20 +02:00
hwmon hwmon: (cgbc-hwmon) Add missing sensors 2026-09-13 21:19:48 -07:00
i2c
iio
images
infiniband
input
kbuild
kernel-hacking
leds
litmus-tests
livepatch
locking
maintainer
mhi
misc-devices
mm mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
netlabel
netlink neighbour: Enforce min/max to NDTPA_INTERVAL_PROBE_TIME_MS. 2026-09-11 17:25:13 -07:00
networking tcp: do not let tcp_rmem be set below 4096 2026-09-15 15:21:17 +02:00
nvdimm
nvme
PCI Documentation: PCI: Document how to write PCI Host Controller drivers 2026-08-12 14:20:48 -05:00
pcmcia
peci
power
process Coccinelle patches for Linux v7.3 2026-08-30 10:42:40 -07:00
RCU
rust docs: rust: quick-start: remove Ubuntu 25.10 2026-08-10 06:44:10 +02:00
scheduler Merge branch 'tip/sched/urgent' 2026-10-13 13:51:24 +02:00
scsi scsi: leapraid: Standardize NCQ priority sysfs attributes 2026-08-23 21:57:41 -04:00
security Landlock update for v7.3-rc1 2026-08-21 12:28:35 -07:00
sound ALSA: usb-audio: Reverse MIXER_GET_CUR_BROKEN as MIXER_GET_CUR_OK 2026-08-23 11:03:34 +02:00
sphinx
sphinx-includes
sphinx-static Documentation: html: adjust sidebar section titles styling 2026-08-05 13:37:41 -06:00
spi docs: spi: add documentation for userspace device instantiation 2026-08-06 19:13:15 +01:00
staging
sunrpc/xdr nfsd: add support to CB_NOTIFY for dir attribute changes 2026-08-10 09:54:35 -04:00
target
tee
timers
tools Documentation/rtla: Document unsetting options 2026-08-05 10:14:40 +02:00
trace perf tools updates for v7.3 2026-08-22 08:47:50 -07:00
translations RISC-V updates for v7.3-rc3 2026-09-11 13:15:13 -07:00
usb
userspace-api mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
virt Arm: 2026-08-25 11:48:04 -07:00
w1
watchdog docs: watchdog: npcm: Add reset status description 2026-08-10 09:00:04 -07:00
wmi
.gitignore
.renames.txt
atomic_bitops.txt
atomic_t.txt
Changes
CodingStyle
conf.py docs: conf.py: fix the 'utf-8' typo 2026-08-11 10:45:54 -06:00
docutils.conf
index.rst Documentation: html: show sections in the sidebar 2026-08-05 13:04:26 -06:00
Kconfig
Makefile
memory-barriers.txt
SubmittingPatches
subsystem-apis.rst