summaryrefslogtreecommitdiff
path: root/kernel/sched/ext.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched/ext.c')
-rw-r--r--kernel/sched/ext.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 1cfe4b43d31b..603de983a509 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4753,7 +4753,7 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link)
const struct sched_class *new_class =
__setscheduler_class(p->policy, p->prio);
- if (!tryget_task_struct(p))
+ if (scx_get_task_state(p) != SCX_TASK_READY)
continue;
if (old_class != new_class)
@@ -4763,8 +4763,6 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link)
p->scx.slice = SCX_SLICE_DFL;
p->sched_class = new_class;
}
-
- put_task_struct(p);
}
scx_task_iter_stop(&sti);
percpu_up_write(&scx_fork_rwsem);