提交 915777f4 编写于 作者: C Chen Wandun 提交者: Zheng Zengkai

psi: fix wrong iteration in iterate_groups

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I562O9
CVE: NA
backport: openEuler-22.03-LTS

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

It is different to get the cgroup that is used to update psi info in
cgroup v1 and cgroup v2.

task_cgroup can only used in cgroup v1, so add branch to achieve this.
Signed-off-by: NChen Wandun <chenwandun@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 34722d01
...@@ -757,9 +757,13 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter) ...@@ -757,9 +757,13 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
cgroup = task->cgroups->dfl_cgrp; cgroup = task->cgroups->dfl_cgrp;
else { else {
#ifdef CONFIG_CGROUP_CPUACCT #ifdef CONFIG_CGROUP_CPUACCT
if (!cgroup_subsys_on_dfl(cpuacct_cgrp_subsys)) {
rcu_read_lock(); rcu_read_lock();
cgroup = task_cgroup(task, cpuacct_cgrp_id); cgroup = task_cgroup(task, cpuacct_cgrp_id);
rcu_read_unlock(); rcu_read_unlock();
} else {
cgroup = task->cgroups->dfl_cgrp;
}
#else #else
cgroup = NULL; cgroup = NULL;
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册