Skip to content

Commit fbb0164

Browse files
authored
Merge pull request #26 from kkdwivedi/central-fix-nr-slots
scx_central: Break dispatch_to_cpu loop when running out of buffer slots
2 parents 737aa81 + c4c994c commit fbb0164

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scheds/kernel-examples/scx_central.bpf.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ static bool dispatch_to_cpu(s32 cpu)
161161
__sync_fetch_and_add(&nr_mismatches, 1);
162162
scx_bpf_dispatch(p, FALLBACK_DSQ_ID, SCX_SLICE_INF, 0);
163163
bpf_task_release(p);
164+
/*
165+
* We might run out of dispatch buffer slots if we continue dispatching
166+
* to the fallback DSQ, without dispatching to the local DSQ of the
167+
* target CPU. In such a case, break the loop now as will fail the
168+
* next dispatch operation.
169+
*/
170+
if (!scx_bpf_dispatch_nr_slots())
171+
break;
164172
continue;
165173
}
166174

0 commit comments

Comments
 (0)