[Intel-gfx] [PATCH v2 4/5] drm/i915: Spin for struct_mutex inside shrinker
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Tue Jun 13 13:59:09 UTC 2017
On pe, 2017-06-09 at 12:03 +0100, Chris Wilson wrote:
> Having resolved whether or not we would deadlock upon a call to
> mutex_lock(&dev->struct_mutex), we can then spin for the contended
> struct_mutex if we are not the owner. We cannot afford to simply block
> and wait for the mutex, as the owner may itself be waiting for the
> allocator -- i.e. a cyclic deadlock. This should significantly improve
> the chance of running the shrinker for other processes whilst the GPU is
> busy.
>
> A more balanced approach would be to optimistically spin whilst the
> mutex owner was on the cpu and there was an opportunity to acquire the
> mutex for ourselves quickly. However, that requires support from
> kernel/locking/ and a new mutex_spin_trylock() primitive.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
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