Skip to content

Commit

Permalink
ext: exclude exiting/autogroup tasks from cgroup logic
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
  • Loading branch information
Andrea Righi committed Jan 29, 2024
1 parent fa75b1f commit 6f51182
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kernel/sched/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -2678,8 +2678,12 @@ int scx_cgroup_can_attach(struct cgroup_taskset *tset)
return 0;

cgroup_taskset_for_each(p, css, tset) {
struct cgroup *from = tg_cgrp(task_group(p));
struct cgroup *from;

if (p->flags & PF_EXITING ||
task_group_is_autogroup(task_group(p)))
continue;
from = tg_cgrp(task_group(p));
if (SCX_HAS_OP(cgroup_prep_move)) {
ret = SCX_CALL_OP_RET(SCX_KF_SLEEPABLE, cgroup_prep_move,
p, from, css->cgroup);
Expand All @@ -2695,6 +2699,9 @@ int scx_cgroup_can_attach(struct cgroup_taskset *tset)

err:
cgroup_taskset_for_each(p, css, tset) {
if (p->flags & PF_EXITING ||
task_group_is_autogroup(task_group(p)))
continue;
if (!p->scx.cgrp_moving_from)
break;
if (SCX_HAS_OP(cgroup_cancel_move))
Expand Down Expand Up @@ -2748,6 +2755,9 @@ void scx_cgroup_cancel_attach(struct cgroup_taskset *tset)
goto out_unlock;

cgroup_taskset_for_each(p, css, tset) {
if (p->flags & PF_EXITING ||
task_group_is_autogroup(task_group(p)))
continue;
if (SCX_HAS_OP(cgroup_cancel_move)) {
WARN_ON_ONCE(!p->scx.cgrp_moving_from);
SCX_CALL_OP(SCX_KF_SLEEPABLE, cgroup_cancel_move, p,
Expand Down

0 comments on commit 6f51182

Please sign in to comment.