[Devel] [PATCH 08/17] oom: allow to throttle due to cfs bandwidth while invoking oom
Vladimir Davydov
vdavydov at parallels.com
Fri Aug 14 10:03:32 PDT 2015
An oom victim task might be throttled due to exceeding cpu cgroup cfs
bandwidth. If it was throttled while executing in the userspace and
there is another task in the same cgroup looping in the kernel trying to
allocate a memory page, the oom victim will never get a chance to
execute due to cfs boosting.
Fix this by inserting cond_resched_may_throttle() to oom handler.
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
mm/memcontrol.c | 2 ++
mm/page_alloc.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c96bbc11236c..47d859c6cb6f 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2316,6 +2316,8 @@ static bool mem_cgroup_handle_oom(struct mem_cgroup *memcg, gfp_t mask,
struct oom_wait_info owait;
bool locked, need_to_kill;
+ cond_resched_may_throttle();
+
owait.memcg = memcg;
owait.wait.flags = 0;
owait.wait.func = memcg_oom_wake_function;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b22b5f1a8450..5d528c1b370a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2153,6 +2153,8 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
{
struct page *page;
+ cond_resched_may_throttle();
+
/* Acquire the OOM killer lock for the zones in zonelist */
if (!try_set_zonelist_oom(zonelist, gfp_mask)) {
schedule_timeout_uninterruptible(1);
--
2.1.4
More information about the Devel
mailing list