diff options
| author | Tejun Heo <tj@kernel.org> | 2026-10-26 14:17:47 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-10-27 09:40:56 -1000 |
| commit | a043733588a06e12e69918fbf080a6c45446e6a5 (patch) | |
| tree | a203b739334cf5858f66886e65bb2da23d044ca5 /kernel/sysctl-test.c | |
| parent | f0bbe21d73e2784fea25524af6e8e241b40b5b22 (diff) | |
sched_ext: Let the bypass load balancer move tasks homed on other cpus
The following patch uses the bypass load balancer to drain a cpu's bypass
DSQ when the host loses SCX_CAP_BASE there. The host no longer consumes that
DSQ, so the drain has to move every task on it. The balancer skips the ones
homed on another cpu.
An earlier pass moved such a task in from its home cpu's DSQ, and the donor
cpu has not consumed it yet. A task's DSQ membership may only change under
the task's rq lock, which the balancer does not hold.
Take such a task off the donor DSQ with unlink_dsq_and_switch_rq_lock(), the
handshake a remote consumer uses. It drops the DSQ lock and switches to the
task's rq lock. A dequeue that gets in between takes the task, and the
balancer moves on. The insert then runs under the task's home rq lock, as it
already does for a donor-homed task.
A task whose donee is its own cpu can always run there.
task_can_run_on_remote_rq() warns when asked about a task's own cpu, so the
balancer skips the test for such a task.
The walk holds the donor rq lock, which keeps the donor cpu's dispatch and
its enqueuers away from the donor DSQ. A move of a task homed elsewhere
switches to the task's rq lock, and both can reach the DSQ meanwhile. The
parked cursor keeps the walk's place through a consume, and the sequence
bound keeps a task enqueued meanwhile out of the pass.
v2: The description says "the following patch", not "patches", uses the
balancer to drain a DSQ.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'kernel/sysctl-test.c')
0 files changed, 0 insertions, 0 deletions
