[Intel-gfx] [PATCH 6/6] drm/i915: Only free the oldest stale object before a fresh allocation
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Wed Aug 16 13:53:59 UTC 2017
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 at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com> #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 at linux.intel.com>
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list