drm/i915: Early rejection of buffer allocations larger than RAM
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 3 Sep 2018 08:33:36 +0000 (09:33 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 3 Sep 2018 11:02:04 +0000 (12:02 +0100)
commite0ff7a7cddeff8ab2445f9d33f2416f8f89f9bca
tree7d84162c185d09b0526e4b833b714ee12cf1a1fb
parentfddcd00a49e9122a3579247151e9cb3ce5a1a36e
drm/i915: Early rejection of buffer allocations larger than RAM

We currently try to pin and allocate the whole buffer at a time. If that
object is larger than RAM, we will try to pin the whole of physical
memory, force the machine into oom, and then still fail the allocation.

If the request is obviously too large, error out early. We opt to do
this in the backend to make it easy to use alternate paths that do not
require the entire object pinned, or may easily handle proxy objects
that are larger than physical memory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180903083337.13134-4-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c