Re: [PATCH v2 3/3] augmented rbtree: rework the RB_DECLARE_CALLBACKS macro definition

From: Peter Zijlstra
Date: Tue Jul 02 2019 - 07:52:38 EST


On Tue, Jul 02, 2019 at 12:58:19AM -0700, Michel Lespinasse wrote:
> - Change the definition of the RBCOMPUTE function. The propagate
> callback repeatedly calls RBCOMPUTE as it moves from leaf to root.
> it wants to stop recomputing once the augmented subtree information
> doesn't change. This was previously checked using the == operator,
> but that only works when the augmented subtree information is a
> scalar field. This commit modifies the RBCOMPUTE function so that
> it now sets the augmented subtree information instead of returning it,
> and returns a boolean value indicating if the propagate callback
> should stop.

I suppose that makes sense and saves a copy over adding RBEQUAL() like I
proposed earlier.

> - Reorder the RB_DECLARE_CALLBACKS macro arguments, following the
> style of the INTERVAL_TREE_DEFINE macro, so that RBSTATIC and RBNAME
> are passed last.

That's, IMO, a weird change. C has storage type and name first, why
would you want to put that last. If anything, change
INTERVAL_TREE_DEFINE().

Also; this is two changes and one patch; ISTR we have rules about those
things :-)

> The motivation for this change is that I want to introduce augmented rbtree
> uses where the augmented data for the subtree is a struct instead of a scalar.

I'm not seeing how this justifies the second thing.