From: Xunlei Pang xlpang@linux.alibaba.com
maillist inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8QUNW
Reference: https://github.com/alibaba/cloud-kernel/commit/798cfa768c743e03aac3336a43bd2...
----------------------------------------------
to #26424323
task_css() should be protected by rcu, fix several callers.
Fixes: 1f49a7385032 ("alinux: psi: Support PSI under cgroup v1") 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 Conflicts: kernel/sched/psi.c mm/oom_kill.c Signed-off-by: Lu Jialin lujialin4@huawei.com --- kernel/sched/psi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index f6995017addf..c972fb406e95 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -890,8 +890,13 @@ static inline struct psi_group *task_psi_group(struct task_struct *task) if (!cgroup_subsys_on_dfl(cpuacct_cgrp_subsys)) { if (static_branch_likely(&psi_v1_disabled)) return &psi_system; - else - return cgroup_psi(task_cgroup(task, cpuacct_cgrp_id)); + else { + struct cgroup *cgroup; + rcu_read_lock(); + cgroup = task_cgroup(task, cpuacct_cgrp_id); + rcu_read_unlock(); + return cgroup_psi(cgroup); + } } else return cgroup_psi(task_dfl_cgroup(task)); #endif