未验证 提交 536e70da 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!1154 [sync] PR-582: mm: oom: move memcg_print_bad_task() out of mem_cgroup_scan_tasks()

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/582 
 
#I6NYW4

Fix a type cast bug in mm/oom 
 
Link:https://gitee.com/openeuler/kernel/pulls/1154 

Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
...@@ -417,7 +417,7 @@ DECLARE_STATIC_KEY_FALSE(memcg_qos_stat_key); ...@@ -417,7 +417,7 @@ DECLARE_STATIC_KEY_FALSE(memcg_qos_stat_key);
bool memcg_low_priority_scan_tasks(int (*)(struct task_struct *, void *), bool memcg_low_priority_scan_tasks(int (*)(struct task_struct *, void *),
void *); void *);
void memcg_print_bad_task(void *arg, int ret); void memcg_print_bad_task(struct oom_control *oc);
extern int sysctl_memcg_qos_handler(struct ctl_table *table, extern int sysctl_memcg_qos_handler(struct ctl_table *table,
int write, void __user *buffer, size_t *length, loff_t *ppos); int write, void __user *buffer, size_t *length, loff_t *ppos);
#endif #endif
......
...@@ -1222,9 +1222,6 @@ int mem_cgroup_scan_tasks(struct mem_cgroup *memcg, ...@@ -1222,9 +1222,6 @@ int mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
break; break;
} }
} }
#ifdef CONFIG_MEMCG_QOS
memcg_print_bad_task(arg, ret);
#endif
return ret; return ret;
} }
...@@ -4012,14 +4009,12 @@ bool memcg_low_priority_scan_tasks(int (*fn)(struct task_struct *, void *), ...@@ -4012,14 +4009,12 @@ bool memcg_low_priority_scan_tasks(int (*fn)(struct task_struct *, void *),
return oc->chosen ? true : false; return oc->chosen ? true : false;
} }
void memcg_print_bad_task(void *arg, int ret) void memcg_print_bad_task(struct oom_control *oc)
{ {
struct oom_control *oc = arg;
if (!static_branch_likely(&memcg_qos_stat_key)) if (!static_branch_likely(&memcg_qos_stat_key))
return; return;
if (!ret && oc->chosen) { if (oc->chosen) {
struct mem_cgroup *memcg; struct mem_cgroup *memcg;
memcg = mem_cgroup_from_task(oc->chosen); memcg = mem_cgroup_from_task(oc->chosen);
...@@ -4050,6 +4045,13 @@ int sysctl_memcg_qos_handler(struct ctl_table *table, int write, ...@@ -4050,6 +4045,13 @@ int sysctl_memcg_qos_handler(struct ctl_table *table, int write,
return ret; return ret;
} }
#else
void memcg_print_bad_task(struct oom_control *oc)
{
}
#endif #endif
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
......
...@@ -408,9 +408,10 @@ static void select_bad_process(struct oom_control *oc) ...@@ -408,9 +408,10 @@ static void select_bad_process(struct oom_control *oc)
{ {
oc->chosen_points = LONG_MIN; oc->chosen_points = LONG_MIN;
if (is_memcg_oom(oc)) if (is_memcg_oom(oc)) {
mem_cgroup_scan_tasks(oc->memcg, oom_evaluate_task, oc); if (!mem_cgroup_scan_tasks(oc->memcg, oom_evaluate_task, oc))
else { memcg_print_bad_task(oc);
} else {
struct task_struct *p; struct task_struct *p;
#ifdef CONFIG_MEMCG_QOS #ifdef CONFIG_MEMCG_QOS
...@@ -473,9 +474,10 @@ static void dump_tasks(struct oom_control *oc) ...@@ -473,9 +474,10 @@ static void dump_tasks(struct oom_control *oc)
pr_info("Tasks state (memory values in pages):\n"); pr_info("Tasks state (memory values in pages):\n");
pr_info("[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name\n"); pr_info("[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name\n");
if (is_memcg_oom(oc)) if (is_memcg_oom(oc)) {
mem_cgroup_scan_tasks(oc->memcg, dump_task, oc); if (!mem_cgroup_scan_tasks(oc->memcg, dump_task, oc))
else { memcg_print_bad_task(oc);
} else {
struct task_struct *p; struct task_struct *p;
rcu_read_lock(); rcu_read_lock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册