All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Allocate atomically in execbuf path
@ 2013-11-27  0:55 Ben Widawsky
  2013-11-27  1:10 ` Ben Widawsky
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ben Widawsky @ 2013-11-27  0:55 UTC (permalink / raw)
  To: Intel GFX; +Cc: Daniel Vetter, Ben Widawsky, Ben Widawsky

If we end up calling the shrinker, which in turn requires the OOM
killer, we may end up infinitely waiting for a process to die if the OOM
chooses. The case that this prevents occurs in execbuf. The forked
variants of gem_evict_everything is a good way to hit it. This is
exacerbated by Daniel's recent patch to give OOM precedence to the GEM
tests.

It's a twisted form of a deadlock.

What occurs is the following (assume just 2 procs)
1. proc A gets to execbuf while out of memory, gets struct_mutex.
2. OOM killer comes in and chooses proc B
3. proc B closes it's fds, which requires struct mutex, blocks
4, OOM killer waits for B to die before killing another process (this
part is speculative)

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index fb2d548..a60894d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1842,12 +1842,12 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
 	BUG_ON(obj->base.read_domains & I915_GEM_GPU_DOMAINS);
 	BUG_ON(obj->base.write_domain & I915_GEM_GPU_DOMAINS);
 
-	st = kmalloc(sizeof(*st), GFP_KERNEL);
+	st = kmalloc(sizeof(*st), GFP_NOWAIT);
 	if (st == NULL)
 		return -ENOMEM;
 
 	page_count = obj->base.size / PAGE_SIZE;
-	if (sg_alloc_table(st, page_count, GFP_KERNEL)) {
+	if (sg_alloc_table(st, page_count, GFP_NOWAIT)) {
 		kfree(st);
 		return -ENOMEM;
 	}
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-27  6:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27  0:55 [PATCH] drm/i915: Allocate atomically in execbuf path Ben Widawsky
2013-11-27  1:10 ` Ben Widawsky
2013-11-27  1:21   ` Ben Widawsky
2013-11-27  4:23 ` Ben Widawsky
2013-11-27  6:48   ` Daniel Vetter
2013-11-27  6:48   ` Ben Widawsky
2013-11-27  6:53 ` [PATCH] drm/i915: Optionally defer context closing Ben Widawsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.