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

From: Michal Koutný
Date: Wed Feb 08 2023 - 16:57:22 EST


On Wed, Feb 08, 2023 at 02:20:12PM -0500, Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> Hm, I don't think it does. It sets up *iter to point to the parent for
> the _next() call, but it returns task_dfl_cgroup()->psi. The next call
> does the same: cgroup = *iter, *iter = parent, return cgroup->psi.

You are right.

> It could be a bit more readable to have *iter always point to the
> current cgroup - but no strong preference either way from me:

A casually reading half-brain finds this more idiomatic :)

I just hope the "preloading" of the parent via iter isn't crucial to the
performance change.

Kairui, I like this reorganization and its effect!

Michal