Skip to content

Commit

Permalink
drm/i915: If we hit OOM when allocating GTT pages, clear the aperture
Browse files Browse the repository at this point in the history
Rather than evicting an object at random, which is unlikely to alleviate
the memory pressure sufficient to allow us to continue, zap the entire
aperture. That should give the system long enough to recover and reap
some pages from the evicted objects, forestalling the allocation error
for the new object.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
  • Loading branch information
Chris Wilson committed Jan 11, 2011
1 parent 092de6f commit 809b633
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2782,18 +2782,16 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
obj->gtt_space = NULL;

if (ret == -ENOMEM) {
/* first try to clear up some space from the GTT */
ret = i915_gem_evict_something(dev, size,
alignment,
map_and_fenceable);
/* first try to reclaim some memory by clearing the GTT */
ret = i915_gem_evict_everything(dev, false);
if (ret) {
/* now try to shrink everyone else */
if (gfpmask) {
gfpmask = 0;
goto search_free;
}

return ret;
return -ENOMEM;
}

goto search_free;
Expand All @@ -2808,9 +2806,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
drm_mm_put_block(obj->gtt_space);
obj->gtt_space = NULL;

ret = i915_gem_evict_something(dev, size,
alignment, map_and_fenceable);
if (ret)
if (i915_gem_evict_everything(dev, false))
return ret;

goto search_free;
Expand Down

0 comments on commit 809b633

Please sign in to comment.