提交 7092d9c3 编写于 作者: J Jing Xiangfeng 提交者: Zheng Zengkai

mm: fix oom killing for disabled pid

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I46IUJ
CVE: NA

--------------------------------------

In oom_next_task(), if points is equal to LONG_MIN, then we choose it to
kill. That is not correct. LONG_MIN means to disable killing it. So fix
it.

Fixes: 4da32073 ("memcg: support priority for oom")
Signed-off-by: NJing Xiangfeng <jingxiangfeng@huawei.com>
Reviewed-by: NChen Wandun <chenwandun@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 717056ae
...@@ -311,15 +311,15 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc) ...@@ -311,15 +311,15 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc)
* choose the task with the highest number of 'points'. * choose the task with the highest number of 'points'.
*/ */
static bool oom_next_task(struct task_struct *task, struct oom_control *oc, static bool oom_next_task(struct task_struct *task, struct oom_control *oc,
unsigned long points) long points)
{ {
struct mem_cgroup *cur_memcg; struct mem_cgroup *cur_memcg;
struct mem_cgroup *oc_memcg; struct mem_cgroup *oc_memcg;
if (!static_branch_likely(&memcg_qos_stat_key)) if (!static_branch_likely(&memcg_qos_stat_key))
return !points || points < oc->chosen_points; return (points == LONG_MIN || points < oc->chosen_points);
if (!points) if (points == LONG_MIN)
return true; return true;
if (!oc->chosen) if (!oc->chosen)
...@@ -341,9 +341,9 @@ static bool oom_next_task(struct task_struct *task, struct oom_control *oc, ...@@ -341,9 +341,9 @@ static bool oom_next_task(struct task_struct *task, struct oom_control *oc,
} }
#else #else
static inline bool oom_next_task(struct task_struct *task, static inline bool oom_next_task(struct task_struct *task,
struct oom_control *oc, unsigned long points) struct oom_control *oc, long points)
{ {
return !points || points < oc->chosen_points; return (points == LONG_MIN || points < oc->chosen_points);
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册