On Sat, 2017-08-12 at 12:51 +0100, Chris Wilson wrote: > Inspired by Tvrtko's critique of the reaping of the stale contexts > before allocating a new one, also limit the freed object reaping to the > oldest stale object before allocating a fresh object. Unlike contexts, > objects may have radically different sizes of backing storage, but > similar to contexts, whilst we want to prevent starvation due to > excessive freed lists, we also want do not want to delay fresh > allocations for too long. Only freeing the oldest on the freed object > list before each allocation is a reasonable compromise. > > v2: Only a single consumer of llist_del_first() is allowed (although > multiple llist_add are still allowed in parallel). Unlike > i915_gem_context, i915_gem_flush_free_objects() is itself not serialized > and so we need to add our own spinlock. Otherwise KASAN eventually spots > a use-after-free for the race on *first->next. > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> #v1 <SNIP> > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -1466,6 +1466,7 @@ struct i915_gem_mm { > */ > struct llist_head free_list; > struct work_struct free_work; > + spinlock_t free_lock; Please document the scope of this lock here. Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> Regards, Joonas -- Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx