From: Peter Zijlstra <peterz@infradead.org>
To: Yiwei Lin <s921975628@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] rbtree: update augmented data on the way down in rb_add_augmented_cached()
Date: Tue, 29 Sep 2026 09:40:38 +0200 [thread overview]
Message-ID: <20260929074038.GQ2009045@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260929052446.159008-1-s921975628@gmail.com>
On Tue, Sep 29, 2026 at 01:24:46PM +0800, Yiwei Lin wrote:
> On 2026/09/29 05:37, Peter Zijlstra wrote:
> > This builds and boot, so it must be perfect, right ;-)
> >
> > Assisted-by: Brain
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>
> Right, thanks.
>
> If you're fine with me carrying it, I can take it into v2 with and
> derive ->merge() from the same RB_AUG() list, so
> rb_add_augmented_cached() folds the new node into its ancestors in
> the one pass down instead of the ->propagate() round trip.
>
> One thing I am aware here: RB_AUG()'s cmp only
> expresses "pick one of the two", so min/max style aggregates; a sum or
> a count (subtree size, total weight) can't be written, where the old
> RBCOMPUTE could do anything. Nobody in-tree needs that today, so it might
> be acceptable as is, but it's a regression in generality for the same
> price:
>
> RB_AUG(val, aug, fold) /* _val = fold(_val, child->aug) */
>
> keeps the register-local recompute exactly as it is, drops RB_MIN /
> RB_MAX in favour of the existing min()/max(), and a sum is just
> "a + b". For sched that's min, max and a wrapping-safe min for
> min_vruntime. Do you think this can be accepted as is, or should I try
> to make it more general?
The fold() thing is indeed an excellent suggestion. Make it so ;-)
Thanks!
next prev parent reply other threads:[~2026-09-29 7:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 12:26 [PATCH 0/3] rbtree: fix rb_add_augmented_cached() descent and exercise rb_add*() helpers in rbtree_test Yiwei Lin
2026-09-28 12:26 ` [PATCH 1/3] rbtree_test: use rb_add() and rb_add_cached() for the basic tests Yiwei Lin
2026-09-28 12:26 ` [PATCH 2/3] rbtree: update augmented data on the way down in rb_add_augmented_cached() Yiwei Lin
2026-09-28 13:37 ` Peter Zijlstra
2026-09-28 14:05 ` Peter Zijlstra
2026-09-28 15:00 ` Peter Zijlstra
2026-09-28 19:15 ` Yiwei Lin
2026-09-28 21:37 ` Peter Zijlstra
2026-09-29 5:24 ` Yiwei Lin
2026-09-29 7:40 ` Peter Zijlstra [this message]
2026-09-28 12:26 ` [PATCH 3/3] rbtree_test: use rb_add_augmented_cached() for the cached augmented test Yiwei Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260929074038.GQ2009045@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=dave@stgolabs.net \
--cc=juri.lelli@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=s921975628@gmail.com \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®