Skip to content

some cleanups related to RB_DECLARE_CALLBACKS_MAX

Uladzislau Rezki (Sony) linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2augmented rbtree: use max3() in the *_compute_max() functioninclude/linux/rbtree_augmented.h tools/include/linux/rbtree_augmented.h+40 -402 replies
2/2mm/vmalloc: use generated callback to populate subtree_max_sizemm/vmalloc.c+1 -302 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchMichel Lespinasse
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] some cleanups related to RB_DECLARE_CALLBACKS_MAX

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(-)
Signature · 1 line
2.11.0