drm/i915: Borrow our struct_mutex for the direct reclaim
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 21 Nov 2012 13:04:04 +0000 (13:04 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 21 Nov 2012 16:47:14 +0000 (17:47 +0100)
commit5774506f157a91400c587b85d1ce4de56f0d32f6
tree167ec5514586d474a34f9fa4185fcc56a4034ae1
parent8742267af4043606869f5b8dadbef635405543c3
drm/i915: Borrow our struct_mutex for the direct reclaim

If we have hit oom whilst holding our struct_mutex, then currently we
cannot reap our own GPU buffers which likely pin most of memory, making
an outright OOM more likely. So if we are running in direct reclaim and
already hold the mutex, attempt to free buffers knowing that the
original function can not continue until we return.

v2: Add a note explaining that the mutex may be stolen due to
pre-emption, and that is bad.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem.c