drm/i915: Move stale context reaping to common i915_gem_context_create
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 5 Jul 2017 14:26:32 +0000 (15:26 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 6 Jul 2017 10:50:52 +0000 (11:50 +0100)
commitddfc925851b4f0ae36b21a5b545e4002c4259c42
treeccda1654bfd7f00dc60c96ee74a9140b5413d679
parente4d5dc218c4a1d1f555448825f5a8d7b1ac82959
drm/i915: Move stale context reaping to common i915_gem_context_create

We need to reap the stale contexts for all new contexts, be they created
by user in i915_gem_context_ioctl or from opening a new file in
i915_gem_context_open. Both paths may be called very frequently
accumulating many stale contexts before any worker has a chance to run
and free their memory.

Fixes: 1acfc104cdf8 ("drm/i915: Enable rcu-only context lookups")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170705142634.18554-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_context.c