Skip to content

Commit

Permalink
drm/i915/gem: Retire directly for mmap-offset shrinking
Browse files Browse the repository at this point in the history
Now that we can retire without taking struct_mutex, we can do so to
handle shrinking the mmap-offset space after an allocation failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191004134015.13204-11-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Oct 4, 2019
1 parent f33a8a5 commit 789ed95
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions drivers/gpu/drm/i915/gem/i915_gem_mman.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,12 @@ static int create_mmap_offset(struct drm_i915_gem_object *obj)
return 0;

/* Attempt to reap some mmap space from dead objects */
do {
err = i915_gem_wait_for_idle(i915, MAX_SCHEDULE_TIMEOUT);
if (err)
break;
err = i915_retire_requests_timeout(i915, MAX_SCHEDULE_TIMEOUT);
if (err)
return err;

i915_gem_drain_freed_objects(i915);
err = drm_gem_create_mmap_offset(&obj->base);
if (!err)
break;

} while (flush_delayed_work(&i915->gem.retire_work));

return err;
i915_gem_drain_freed_objects(i915);
return drm_gem_create_mmap_offset(&obj->base);
}

int
Expand Down

0 comments on commit 789ed95

Please sign in to comment.