cgroup: Avoid extra dereference in css_populate_dir()

[ Upstream commit d24f05987c ]

Use css directly instead of dereferencing it from &cgroup->self, while
adding the cgroup v2 cft base and psi files in css_populate_dir(). Both
points to the same css, when css->ss is NULL, this avoids extra deferences
and makes code consistent in usage across the function.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Kamalesh Babulal 2023-09-12 12:34:35 +05:30 committed by Greg Kroah-Hartman
parent a4dc742456
commit a2225b7af5

View File

@ -1728,13 +1728,13 @@ static int css_populate_dir(struct cgroup_subsys_state *css)
if (!css->ss) { if (!css->ss) {
if (cgroup_on_dfl(cgrp)) { if (cgroup_on_dfl(cgrp)) {
ret = cgroup_addrm_files(&cgrp->self, cgrp, ret = cgroup_addrm_files(css, cgrp,
cgroup_base_files, true); cgroup_base_files, true);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (cgroup_psi_enabled()) { if (cgroup_psi_enabled()) {
ret = cgroup_addrm_files(&cgrp->self, cgrp, ret = cgroup_addrm_files(css, cgrp,
cgroup_psi_files, true); cgroup_psi_files, true);
if (ret < 0) if (ret < 0)
return ret; return ret;