提交 07c863f7 编写于 作者: L Lu Jialin 提交者: Zheng Zengkai

memcg: Fix inconsistent oom event behavior for OOM_MEMCG_KILL

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4X0YD?from=project-issue
CVE: NA

--------

Since memory.event is fully supported in cgroupv1, the problem of inconsistent
oom event behavior for OOM_MEMCG_KILL occurs again.
We fix the problem by add a new condition to support the event adding
continue. Therefore, there are two condition:
1) memcg is not root memcg;
2) the memcg is root memcg and the event is OOM_MEMCG_KILL of cgroupv1
Signed-off-by: NLu Jialin <lujialin4@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8f39ae66
......@@ -1197,6 +1197,18 @@ static inline void count_memcg_event_mm(struct mm_struct *mm,
rcu_read_unlock();
}
static bool memcg_event_add(struct mem_cgroup *memcg,
enum memcg_memory_event event)
{
if (!mem_cgroup_is_root(memcg))
return true;
if (event == MEMCG_OOM_KILL && !cgroup_subsys_on_dfl(memory_cgrp_subsys))
return true;
return false;
}
static inline void memcg_memory_event(struct mem_cgroup *memcg,
enum memcg_memory_event event)
{
......@@ -1217,7 +1229,7 @@ static inline void memcg_memory_event(struct mem_cgroup *memcg,
if (cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_LOCAL_EVENTS)
break;
} while ((memcg = parent_mem_cgroup(memcg)) &&
!mem_cgroup_is_root(memcg));
memcg_event_add(memcg, event));
}
static inline void memcg_memory_event_mm(struct mm_struct *mm,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册