Skip to content

Commit 2c3849b

Browse files
committed
drm/i915: Trylock the object when shrinking
We're working on requiring the obj->resv lock during unbind, fix the shrinker to take the object lock. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211216142749.1966107-10-maarten.lankhorst@linux.intel.com
1 parent fb3965f commit 2c3849b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/gpu/drm/i915/gem/i915_gem_shrinker.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,18 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr
405405
list_for_each_entry_safe(vma, next,
406406
&i915->ggtt.vm.bound_list, vm_link) {
407407
unsigned long count = vma->node.size >> PAGE_SHIFT;
408+
struct drm_i915_gem_object *obj = vma->obj;
408409

409410
if (!vma->iomap || i915_vma_is_active(vma))
410411
continue;
411412

413+
if (!i915_gem_object_trylock(obj))
414+
continue;
415+
412416
if (__i915_vma_unbind(vma) == 0)
413417
freed_pages += count;
418+
419+
i915_gem_object_unlock(obj);
414420
}
415421
mutex_unlock(&i915->ggtt.vm.mutex);
416422

0 commit comments

Comments
 (0)