diff options
| author | Tejun Heo <tj@kernel.org> | 2026-08-03 11:01:20 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-08-03 11:01:20 -1000 |
| commit | 9cfc6ab34a3184b3683d27dcccc5c05bede41c37 (patch) | |
| tree | 2bacb57d4c5f0846510cde2f622ac66df5b3ecfd /tools/perf/scripts/python | |
| parent | 13f1eae3b66257625f865babd4fb7c251c8c981e (diff) | |
sched_ext: Add SCX_TASK_PROTECTED
A BPF scheduler can displace any of its tasks at will - cut a running one's
slice with an SCX_ENQ_PREEMPT dispatch, an SCX_KICK_PREEMPT kick or a direct
shortening, and jump a queued one with HEAD insertions. Sometimes the kernel
needs a slice and a DSQ position to stick regardless.
Add SCX_TASK_PROTECTED, guarding both:
- The slice becomes immutable. Every scheduler-reachable write is refused
and counted as SCX_EV_SLICE_DENIED. Higher scheduling classes are
unaffected. PREEMPT|IMMED can't preempt a running protected task and gets
reenqueued.
- A protected task that reached the head of its DSQ keeps it - HEAD
insertions land behind the leading run of protected tasks and reenqueue
sweeps skip them. Only rq-owned DSQs can hold protected tasks, so the walk
runs only for them.
The bit lives in p->scx.flags so that both the refusal and the head walk
read it under the rq lock that protects it.
Protection ends when the slice is consumed, when the task leaves the rq
except for a save/restore on the running task, on a yield, when the
scheduler enters bypass, and when the task leaves scx. The flag is
kernel-internal and not used yet.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
