mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	Jon Maloy <jmaloy@redhat.com>,
	netdev@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] rbtree: declare augmented callbacks per field with RB_AUG()
Date: Wed, 30 Sep 2026 11:13:24 +0200	[thread overview]
Message-ID: <20260930091324.GI88198@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260929152439.91443-3-s921975628@gmail.com>

On Tue, Sep 29, 2026 at 11:24:37PM +0800, Yiwei Lin wrote:

> No functional change intended.

> -#define RB_DECLARE_CALLBACKS_MAX(RBSTATIC, RBNAME, RBSTRUCT, RBFIELD,	      \
> -				 RBTYPE, RBAUGMENTED, RBCOMPUTE)	      \
> -static inline bool RBNAME ## _compute_max(RBSTRUCT *node, bool exit)	      \
> -{									      \
> -	RBSTRUCT *child;						      \
> -	RBTYPE max = RBCOMPUTE(node);					      \
> -	if (node->RBFIELD.rb_left) {					      \
> -		child = rb_entry(node->RBFIELD.rb_left, RBSTRUCT, RBFIELD);   \
> -		if (child->RBAUGMENTED > max)				      \
> -			max = child->RBAUGMENTED;			      \
> -	}								      \
> -	if (node->RBFIELD.rb_right) {					      \
> -		child = rb_entry(node->RBFIELD.rb_right, RBSTRUCT, RBFIELD);  \
> -		if (child->RBAUGMENTED > max)				      \
> -			max = child->RBAUGMENTED;			      \
> -	}								      \
> -	if (exit && node->RBAUGMENTED == max)				      \
> -		return true;						      \
> -	node->RBAUGMENTED = max;					      \
> -	return false;							      \
> -}									      \

The one thing that did get lost is this 'exit' stuff. I'm not sure it
matters, but it might need a mention.

  reply	other threads:[~2026-09-30  9:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 15:24 [PATCH v2 0/4] rbtree: declare augmented callbacks per field, fix rb_add_augmented_cached() descent Yiwei Lin
2026-09-29 15:24 ` [PATCH v2 1/4] rbtree_test: use rb_add() and rb_add_cached() for the basic tests Yiwei Lin
2026-09-29 15:24 ` [PATCH v2 2/4] rbtree: declare augmented callbacks per field with RB_AUG() Yiwei Lin
2026-09-30  9:13   ` Peter Zijlstra [this message]
2026-09-29 15:24 ` [PATCH v2 3/4] rbtree: update augmented data on the way down in rb_add_augmented_cached() Yiwei Lin
2026-09-29 15:24 ` [PATCH v2 4/4] 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=20260930091324.GI88198@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=dave@stgolabs.net \
    --cc=jmaloy@redhat.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --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®