Skip to content

Commit 8bfd3b5

Browse files
laoarKernel Patches Daemon
authored andcommitted
cgroup, psi: Init root cgroup psi to psi_system
By initializing the root cgroup's psi field to psi_system, we can consistently obtain the psi information for all cgroups from the struct cgroup. Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
1 parent d445fbf commit 8bfd3b5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/linux/psi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
3434
#ifdef CONFIG_CGROUPS
3535
static inline struct psi_group *cgroup_psi(struct cgroup *cgrp)
3636
{
37-
return cgroup_ino(cgrp) == 1 ? &psi_system : cgrp->psi;
37+
return cgrp->psi;
3838
}
3939

4040
int psi_cgroup_alloc(struct cgroup *cgrp);

kernel/cgroup/cgroup.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ static struct static_key_true *cgroup_subsys_on_dfl_key[] = {
164164
static DEFINE_PER_CPU(struct cgroup_rstat_cpu, cgrp_dfl_root_rstat_cpu);
165165

166166
/* the default hierarchy */
167-
struct cgroup_root cgrp_dfl_root = { .cgrp.rstat_cpu = &cgrp_dfl_root_rstat_cpu };
167+
struct cgroup_root cgrp_dfl_root = {
168+
.cgrp.rstat_cpu = &cgrp_dfl_root_rstat_cpu,
169+
.cgrp.psi = &psi_system,
170+
};
168171
EXPORT_SYMBOL_GPL(cgrp_dfl_root);
169172

170173
/*

0 commit comments

Comments
 (0)