[PATCH 0/2] some cleanups related to RB_DECLARE_CALLBACKS_MAX

From: Uladzislau Rezki (Sony)
Date: Sun Aug 11 2019 - 14:46:30 EST


Recently we have got RB_DECLARE_CALLBACKS_MAX template that is supposed
to be used in case of having an augmented value as scalar value. First
patch just simplifies the *_compute_max() callback by using max3()
macro that makes the code more transparent, i think. No functional changes.

Second patch reuses RB_DECLARE_CALLBACKS_MAX template's internal functionality,
that is generated to manage augment red-black tree instead of using our own and
the same logic in vmalloc. Just get rid of duplication. No functional changes.

Also i have open question related to validating of the augment tree, i mean
in case of debugging to check that nodes are maintained correctly. Please
have a look here: https://lkml.org/lkml/2019/7/29/304

Basically we can add one more function under RB_DECLARE_CALLBACKS_MAX template
making it public that checks a tree and its augmented nodes. At least i see
two users where it can be used: vmalloc and lib/rbtree_test.c.

Appreciate for any comments.

Uladzislau Rezki (Sony) (2):
augmented rbtree: use max3() in the *_compute_max() function
mm/vmalloc: use generated callback to populate subtree_max_size

include/linux/rbtree_augmented.h | 40 +++++++++++++++++-----------------
mm/vmalloc.c | 31 +-------------------------
tools/include/linux/rbtree_augmented.h | 40 +++++++++++++++++-----------------
3 files changed, 41 insertions(+), 70 deletions(-)

--
2.11.0