[PATCH 48/48] page allocator: Tmp OOM deadlock w/a from Chris

Ben Widawsky
2013-12-06T22:18:56Z

Deadlock with OOM lock, and struct_mutex where we invoke the OOM killer
while holding struct_mutex, and unsuccessfully try to kill (because
close requires struct_mutex) other processes using a lot of GEM memory.

Authored-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
mm/page_alloc.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 580a5f0..708c038 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2467,6 +2467,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
bool sync_migration = false;
bool deferred_compaction = false;
bool contended_compaction = false;
+ int retry = 5*HZ;

/*
* In the slowpath, we sanity check order to avoid ever trying to
@@ -2619,6 +2620,9 @@ rebalance:
goto nopage;
}

+ if (!--retry)
+ goto nopage;
+
goto restart;
}
}
--
1.8.4.2