From: Sha Zhengju <handai.szj@xxxxxxxxxx> Sysctl oom_kill_allocating_task enables or disables killing the OOM-triggering task in out-of-memory situations, but it only works on overall system-wide oom. But it's also a useful indication in memcg so we take it into consideration while oom happening in memcg. Other sysctl such as panic_on_oom has already been memcg-ware. Signed-off-by: Sha Zhengju <handai.szj@xxxxxxxxxx> --- mm/memcontrol.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e4e9b18..c329940 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1486,6 +1486,15 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, check_panic_on_oom(CONSTRAINT_MEMCG, gfp_mask, order, NULL); totalpages = mem_cgroup_get_limit(memcg) >> PAGE_SHIFT ? : 1; + if (sysctl_oom_kill_allocating_task && current->mm && + !oom_unkillable_task(current, memcg, NULL) && + current->signal->oom_score_adj != OOM_SCORE_ADJ_MIN) { + get_task_struct(current); + oom_kill_process(current, gfp_mask, order, 0, totalpages, memcg, NULL, + "Memory cgroup out of memory (oom_kill_allocating_task)"); + return; + } + for_each_mem_cgroup_tree(iter, memcg) { struct cgroup *cgroup = iter->css.cgroup; struct cgroup_iter it; -- 1.7.6.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>