summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorPeter Zijlstra (Intel) <peterz@infradead.org>2026-10-05 17:32:34 +0800
committerPeter Zijlstra <peterz@infradead.org>2026-10-13 13:51:27 +0200
commitc2c620f4345c50006af90c37fd104fed8e9dea14 (patch)
treee609257b6a909d6c5f426c43b42ec9cbc923b012 /tools/perf/scripts/python
parent9fc91ae6852aa6e63c08b6093634cfcc85021b4e (diff)
rbtree: Declare augmented callbacks per field with RB_AUG()
RB_DECLARE_CALLBACKS_MULTI() asks its user for a function that copies the augmented fields and one that recomputes them from the children, with the early-exit protocol of ->propagate() hand-coded in the latter. sched/eevdf, its only user, needs five helpers for three fields. Describe each augmented field instead: RB_AUG(val, aug, fold) names the per-node value, the member holding the subtree aggregate and how two aggregates combine (min, max, a sum, ...). RB_AUG_FUNC() takes a function for the per-node value. The template then generates, per field, a recompute that works on a local and stores once, and a copy, and combines them into the callbacks; the early exit is the AND of the per-field results. RB_DECLARE_CALLBACKS() is the only template left. RB_DECLARE_CALLBACKS_MAX() becomes RB_AUG_FUNC(RBVALUE, RBAUGMENTED, max) in a wrapper, with its RBCOMPUTE argument renamed to RBVALUE, since it returns the per-node scalar and is a different thing from the RBCOMPUTE of the generic template it used to build on. RB_DECLARE_CALLBACKS_MULTI() goes away. sched/eevdf shrinks to a wrapping-safe min() for min_vruntime and three RB_AUG() lines. No functional change intended. [yiwei: take a fold(a, b) instead of a "replace?" compare so that sums and counts can be expressed too, which also lets min()/max() replace RB_MIN()/RB_MAX(); wrapped the lines over 100 columns] Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Yiwei Lin <s921975628@gmail.com> Assisted-by: LLM Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20260928213736.GA2947991@noisy.programming.kicks-ass.net Link: https://patch.msgid.link/20261005093236.62702-3-s921975628@gmail.com
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions