Quoting Tvrtko Ursulin (2020-07-17 13:38:01) > > On 15/07/2020 12:50, Chris Wilson wrote: > > + /* Even if we have not used the cache, we may still have a barrier */ > > + if (!ref->cache) > > + ref->cache = fetch_node(ref->tree.rb_node); > > + > > + /* Keep the MRU cached node for reuse */ > > + if (ref->cache) { > > + /* Discard all other nodes in the tree */ > > + rb_erase(&ref->cache->node, &ref->tree); > > + root = ref->tree; > > + > > + /* Rebuild the tree with only the cached node */ > > + rb_link_node(&ref->cache->node, NULL, &ref->tree.rb_node); > > + rb_insert_color(&ref->cache->node, &ref->tree); > > + GEM_BUG_ON(ref->tree.rb_node != &ref->cache->node); > > + } > > > > spin_unlock_irqrestore(&ref->tree_lock, flags); > > > > @@ -156,6 +168,7 @@ __active_retire(struct i915_active *ref) > > /* ... except if you wait on it, you must manage your own references! */ > > wake_up_var(ref); > > > > + /* Finally free the discarded timeline tree */ > > rbtree_postorder_for_each_entry_safe(it, n, &root, node) { > > GEM_BUG_ON(i915_active_fence_isset(&it->base)); > > kmem_cache_free(global.slab_cache, it); > > Here it frees everything.. so how does ref->cache, being in the tree, > survives? This is the old root which does not contain ref->cache, as we moved that to become the new tree. /* Discard all other nodes in the tree */ rb_erase(&ref->cache->node, &ref->tree); root = ref->tree; _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx