Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
scx: Fix error condition check in __scx_bpf_consume_task()
Browse files Browse the repository at this point in the history
__scx_bpf_consume_task() should test whether the task is still on the DSQ
that's being iterated before erroring out if it's on a local DSQ. Otherwise,
another racing consumer can move the task to a local DSQ triggering a
spurious error. Relocate the error condition.
  • Loading branch information
htejun committed Jun 17, 2024
1 parent c952e64 commit e2c8568
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/sched/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -6092,14 +6092,14 @@ __bpf_kfunc bool __scx_bpf_consume_task(unsigned long it, struct task_struct *p)
*/
dsq = READ_ONCE(p->scx.dsq);

if (unlikely(!dsq || dsq != kit_dsq))
return false;

if (unlikely(dsq->id == SCX_DSQ_LOCAL)) {
scx_ops_error("local DSQ not allowed");
return false;
}

if (unlikely(!dsq || dsq != kit_dsq))
return false;

if (!scx_kf_allowed(SCX_KF_DISPATCH))
return false;

Expand Down

0 comments on commit e2c8568

Please sign in to comment.