Skip to content
Snippets Groups Projects
Commit ee2202d7 authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Allow internal page allocations to fail


Internal objects consistent of scratch pages not subject to the
persistence guarantees of user facing objects. They are used for
example, in ring buffers where they are only required for temporary
storage of commands that will be rewritten every time. As they are
temporary constructs, quietly report -ENOMEM back along the callchain
rather than subject the system to oomkiller if an allocation fails.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171215101753.1519-1-chris@chris-wilson.co.uk
parent ee5b5bf3
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "i915_drv.h" #include "i915_drv.h"
#define QUIET (__GFP_NORETRY | __GFP_NOWARN) #define QUIET (__GFP_NORETRY | __GFP_NOWARN)
#define MAYFAIL (__GFP_RETRY_MAYFAIL | __GFP_NOWARN)
/* convert swiotlb segment size into sensible units (pages)! */ /* convert swiotlb segment size into sensible units (pages)! */
#define IO_TLB_SEGPAGES (IO_TLB_SEGSIZE << IO_TLB_SHIFT >> PAGE_SHIFT) #define IO_TLB_SEGPAGES (IO_TLB_SEGSIZE << IO_TLB_SHIFT >> PAGE_SHIFT)
...@@ -95,7 +96,8 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj) ...@@ -95,7 +96,8 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
struct page *page; struct page *page;
do { do {
page = alloc_pages(gfp | (order ? QUIET : 0), order); page = alloc_pages(gfp | (order ? QUIET : MAYFAIL),
order);
if (page) if (page)
break; break;
if (!order--) if (!order--)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment