diff options
| author | Ryan Newton <newton@meta.com> | 2025-10-15 11:50:35 -0400 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2025-10-15 06:46:25 -1000 |
| commit | 44f5c8ec5b9ad8ed4ade08d727f803b2bb07f1c3 (patch) | |
| tree | 23226ea58376f17c0ae7e357a75e32f5796f04ff /rust/helpers/helpers.c | |
| parent | 347ed2d566dabb06c7970fff01129c4f59995ed6 (diff) | |
sched_ext: Add lockless peek operation for DSQs
The builtin DSQ queue data structures are meant to be used by a wide
range of different sched_ext schedulers with different demands on these
data structures. They might be per-cpu with low-contention, or
high-contention shared queues. Unfortunately, DSQs have a coarse-grained
lock around the whole data structure. Without going all the way to a
lock-free, more scalable implementation, a small step we can take to
reduce lock contention is to allow a lockless, small-fixed-cost peek at
the head of the queue.
This change allows certain custom SCX schedulers to cheaply peek at
queues, e.g. during load balancing, before locking them. But it
represents a few extra memory operations to update the pointer each
time the DSQ is modified, including a memory barrier on ARM so the write
appears correctly ordered.
This commit adds a first_task pointer field which is updated
atomically when the DSQ is modified, and allows any thread to peek at
the head of the queue without holding the lock.
Signed-off-by: Ryan Newton <newton@meta.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions
