[PATCH 1/2] drm/mm: Fix caching of leftmost node in the interval tree

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Tue Feb 20 09:33:51 UTC 2018


Quoting Chris Wilson (2018-02-19 10:57:27)
> When we descend the tree to find our slot, if we step to the right, we
> are no longer the leftmost node.
> 
> Fixes: f808c13fd373 ("lib/interval_tree: fast overlap detection")
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Davidlohr Bueso <dbueso at suse.de>
> Cc: Jérôme Glisse <jglisse at redhat.com>
> Cc: Christian König <christian.koenig at amd.com>

<SNIP>

> @@ -208,11 +209,11 @@ static void drm_mm_interval_tree_add_node(struct drm_mm_node *hole_node,
>                 parent = rb_entry(rb, struct drm_mm_node, rb);
>                 if (parent->__subtree_last < node->__subtree_last)
>                         parent->__subtree_last = node->__subtree_last;
> -               if (node->start < parent->start)
> +               if (node->start < parent->start) {
>                         link = &parent->rb.rb_left;
> -               else {
> +               } else {
>                         link = &parent->rb.rb_right;
> -                       leftmost = true;
> +                       leftmost = false;

As this bug didn't have any functional effect, we could go with
rb_insert_augmented and not try to cache the node if the information
ends up being unused.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas


More information about the dri-devel mailing list