drm/i915: Ratelimit request allocation under oom
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 12 Dec 2017 18:06:52 +0000 (18:06 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 13 Dec 2017 13:17:59 +0000 (13:17 +0000)
commit31c70f97bec3107805df0f491485e7eacbc3a3ae
tree5e9b017c890aa15f7480982951967eda7e232ba4
parent2abe2f844645402e5d47012a04839d1c5cbffd0d
drm/i915: Ratelimit request allocation under oom

If we fail to allocate a request, we can reap the outstanding requests
and push them to the request's slab's freelist before trying again. This
forces us to ratelimit malicious clients that tie up all of the system
resources in requests, instead of causing a system-wide oom.

Testcase: igt/gem_shrink/execbuf1
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171212180652.22061-3-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_request.c