]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched_ext: Don't use double locking to migrate tasks across CPUs
authorTejun Heo <tj@kernel.org>
Wed, 7 Aug 2024 23:15:19 +0000 (13:15 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 13 Aug 2024 19:08:50 +0000 (09:08 -1000)
commit89909296a51e792f296e52e104a04aed0cb7a9e9
tree4df4f1ae59eb8df9103b6b621e6ef671f1b0b7c4
parent33d031ec12105e4e4589dc5f50511a666d6f4b4f
sched_ext: Don't use double locking to migrate tasks across CPUs

consume_remote_task() and dispatch_to_local_dsq() use
move_task_to_local_dsq() to migrate the task to the target CPU. Currently,
move_task_to_local_dsq() expects the caller to lock both the source and
destination rq's. While this may save a few lock operations while the rq's
are not contended, under contention, the double locking can exacerbate the
situation significantly (refer to the linked message below).

Update the migration path so that double locking is not used.
move_task_to_local_dsq() now expects the caller to be locking the source rq,
drops it and then acquires the destination rq lock. Code is simpler this way
and, on a 2-way NUMA machine w/ Xeon Gold 6138, 'hackbench 100 thread 5000`
shows ~3% improvement with scx_simple.

Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20240806082716.GP37996@noisy.programming.kicks-ass.net
Acked-by: David Vernet <void@manifault.com>
kernel/sched/ext.c