Skip to content

Commit 161853a

Browse files
Zhang Qiaohtejun
authored andcommitted
sched/ext: Use tg_cgroup() to elieminate duplicate code
Use tg_cgroup() to eliminate duplicate code patterns in scx_bpf_task_cgroup(). Signed-off-by: Zhang Qiao <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent e418cd2 commit 161853a

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

kernel/sched/ext.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7130,15 +7130,8 @@ __bpf_kfunc struct cgroup *scx_bpf_task_cgroup(struct task_struct *p)
71307130
if (!scx_kf_allowed_on_arg_tasks(__SCX_KF_RQ_LOCKED, p))
71317131
goto out;
71327132

7133-
/*
7134-
* A task_group may either be a cgroup or an autogroup. In the latter
7135-
* case, @tg->css.cgroup is %NULL. A task_group can't become the other
7136-
* kind once created.
7137-
*/
7138-
if (tg && tg->css.cgroup)
7139-
cgrp = tg->css.cgroup;
7140-
else
7141-
cgrp = &cgrp_dfl_root.cgrp;
7133+
cgrp = tg_cgrp(tg);
7134+
71427135
out:
71437136
cgroup_get(cgrp);
71447137
return cgrp;

0 commit comments

Comments
 (0)