Re: [RESEND PATCH 2/3] mm/vmap: add DEBUG_AUGMENT_PROPAGATE_CHECK macro
From: Uladzislau Rezki
Date: Thu Apr 04 2019 - 11:53:21 EST
> > +#if DEBUG_AUGMENT_PROPAGATE_CHECK
> > +static void
> > +augment_tree_propagate_do_check(struct rb_node *n)
> > +{
> > + struct vmap_area *va;
> > + struct rb_node *node;
> > + unsigned long size;
> > + bool found = false;
> > +
> > + if (n == NULL)
> > + return;
> > +
> > + va = rb_entry(n, struct vmap_area, rb_node);
> > + size = va->subtree_max_size;
> > + node = n;
> > +
> > + while (node) {
> > + va = rb_entry(node, struct vmap_area, rb_node);
> > +
> > + if (get_subtree_max_size(node->rb_left) == size) {
> > + node = node->rb_left;
> > + } else {
> > + if (__va_size(va) == size) {
> > + found = true;
> > + break;
> > + }
> > +
> > + node = node->rb_right;
> > + }
> > + }
> > +
> > + if (!found) {
> > + va = rb_entry(n, struct vmap_area, rb_node);
> > + pr_emerg("tree is corrupted: %lu, %lu\n",
> > + __va_size(va), va->subtree_max_size);
> > + }
> > +
> > + augment_tree_propagate_do_check(n->rb_left);
> > + augment_tree_propagate_do_check(n->rb_right);
> > +}
> > +
> > +static void augment_tree_propagate_from_check(void)
>
> Why do you need this intermediate function?
>
> Other than that looks good to me, please free to use
> Reviewed-by: Roman Gushchin <guro@xxxxxx>
>
Will remove, we do not need that extra wrapper.
--
Vlad Rezki