提交 095f0f1b 编写于 作者: X Xunlei Pang 提交者: Zheng Zengkai

cgroup: Fix task_css_check rcu warnings

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4OF4N

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

task_css() should be protected by rcu. In my environment
if not protected by rcu qemu may fail to start.

Fixes: a885e3f9 ("psi: support psi under cgroup v1")
Reported-by: NYang Yingliang <yangyingliang@huawei.com>
Acked-by: NMichael Wang <yun.wany@linux.alibaba.com>
Signed-off-by: NXunlei Pang <xlpang@linux.alibaba.com>
Signed-off-by: NYihao Wu <wuyihao@linux.alibaba.com>
Acked-by: NYang Shi <yang.shi@linux.alibaba.com>
Signed-off-by: NChen Wandun <chenwandun@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 efd726a9
...@@ -755,12 +755,15 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter) ...@@ -755,12 +755,15 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
if (!*iter) { if (!*iter) {
if (static_branch_likely(&psi_v1_disabled)) if (static_branch_likely(&psi_v1_disabled))
cgroup = task->cgroups->dfl_cgrp; cgroup = task->cgroups->dfl_cgrp;
else else {
#ifdef CONFIG_CGROUP_CPUACCT #ifdef CONFIG_CGROUP_CPUACCT
rcu_read_lock();
cgroup = task_cgroup(task, cpuacct_cgrp_id); cgroup = task_cgroup(task, cpuacct_cgrp_id);
rcu_read_unlock();
#else #else
cgroup = NULL; cgroup = NULL;
#endif #endif
}
} else if (*iter == &psi_system) } else if (*iter == &psi_system)
return NULL; return NULL;
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册