Re: [PATCH 2/2] sched/psi: iterate through cgroups directly

From: Michal Koutný
Date: Wed Feb 08 2023 - 12:30:16 EST


On Thu, Feb 09, 2023 at 12:16:54AM +0800, Kairui Song <ryncsn@xxxxxxxxx> wrote:
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> Signed-off-by: Kairui Song <ryncsn@xxxxxxxxx>

Typo?

> -static inline struct psi_group *task_psi_group(struct task_struct *task)
> +static inline struct psi_group *psi_iter_first(struct task_struct *task, void **iter)
> {
> #ifdef CONFIG_CGROUPS
> - if (static_branch_likely(&psi_cgroups_enabled))
> - return cgroup_psi(task_dfl_cgroup(task));
> + if (static_branch_likely(&psi_cgroups_enabled)) {
> + struct cgroup *cgroup = task_dfl_cgroup(task);
> +
> + *iter = cgroup_parent(cgroup);

This seems to skip a cgroup level -- maybe that's the observed
performance gain?

> + return cgroup_psi(cgroup);
> + }
> #endif
> return &psi_system;
> }

Michal

Attachment: signature.asc
Description: Digital signature