[PATCH 9/9] tools/sched_ext: scx_userland: Reject batch size 0
From: Tao Cui
Date: Tue Nov 10 2026 - 07:57:41 EST
From: Tao Cui <cuitao@xxxxxxxxxx>
-b 0 is accepted silently and leaves batch_size at zero, so
dispatch_batch() never moves a task out of the vruntime list into the
dispatched queue: tasks pile up on the vruntime list while
nr_scheduled stays positive and ops.update_idle() keeps kicking cpus;
the system-wide livelock ends when the stall watchdog kills the
scheduler.
Reject a zero batch size at option parsing.
Fixes: cc4448d0856d ("tools/sched_ext: add scx_userland scheduler")
Signed-off-by: Tao Cui <cuitao@xxxxxxxxxx>
---
tools/sched_ext/scx_userland.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/sched_ext/scx_userland.c b/tools/sched_ext/scx_userland.c
index b16b6db5f365..cbd511685449 100644
--- a/tools/sched_ext/scx_userland.c
+++ b/tools/sched_ext/scx_userland.c
@@ -364,6 +364,11 @@ static void pre_bootstrap(int argc, char **argv)
}
}
+ if (!batch_size) {
+ fprintf(stderr, "Invalid batch size %s\n", optarg);
+ exit(1);
+ }
+
/*
* It's not always safe to allocate in a user space scheduler, as an
* enqueued task could hold a lock that we require in order to be able
--
2.53.0
base-commit: 5b740a72b55c4267ba4d8010f17dde26b26f52d3