From: Xunlei Pang xlpang@linux.alibaba.com
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: a885e3f9e457 ("psi: support psi under cgroup v1") Reported-by: Yang Yingliang yangyingliang@huawei.com Acked-by: Michael Wang yun.wany@linux.alibaba.com Signed-off-by: Xunlei Pang xlpang@linux.alibaba.com Signed-off-by: Yihao Wu wuyihao@linux.alibaba.com Acked-by: Yang Shi yang.shi@linux.alibaba.com Signed-off-by: Chen Wandun chenwandun@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- kernel/sched/psi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index ddbd3d79b988..360f13382069 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -755,12 +755,15 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter) if (!*iter) { if (static_branch_likely(&psi_v1_disabled)) cgroup = task->cgroups->dfl_cgrp; - else + else { #ifdef CONFIG_CGROUP_CPUACCT + rcu_read_lock(); cgroup = task_cgroup(task, cpuacct_cgrp_id); + rcu_read_unlock(); #else cgroup = NULL; #endif + } } else if (*iter == &psi_system) return NULL; else