Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

scx: Dispatch locally until ops.cpu_online() invoked #197

Merged
merged 1 commit into from
May 5, 2024

Conversation

Byte-Lab
Copy link
Collaborator

@Byte-Lab Byte-Lab commented May 3, 2024

In sched_ext, there's currently a corner case on the hotplug path wherein a CPU may be onlined and begin scheduling before we've invoked ops.cpu_online() to the scheduler. This can cause confusion by e.g. causing a scheduler to error out if it receives an ops.dispatch() call and accidentally dispatches to an invalid DSQ.

To avoid this scenario, this patch adds a per-CPU boolean variable that tracks when a CPU has been onlined from the perspective of sched_ext.

Note that this patch does not prevent any callback from being invoked on that CPU. It simply prevents us from invoking ops.dispatch(), and forces us to dispatch directly to the local DSQ. We can still, however, receive e.g. ops.runnable() if a per-CPU task is dispatched to the local DSQ of the onlined CPU before the hotplug event is received.

@Byte-Lab Byte-Lab requested a review from htejun May 3, 2024 22:57
kernel/sched/ext.c Outdated Show resolved Hide resolved
kernel/sched/ext.c Outdated Show resolved Hide resolved
In sched_ext, there's currently a corner case on the hotplug path
wherein a CPU may be onlined and begin scheduling _before_ we've invoked
ops.cpu_online() to the scheduler. This can cause confusion by e.g.
causing a scheduler to error out if it receives an ops.dispatch() call
and accidentally dispatches to an invalid DSQ.

To avoid this scenario, this patch adds a per-CPU boolean variable that
tracks when a CPU has been onlined from the perspective of sched_ext.

Note that this patch does not prevent _any_ callback from being invoked
on that CPU. It simply prevents us from invoking ops.dispatch(), and
forces us to dispatch directly to the local DSQ. We can still, however,
receive e.g. ops.runnable() if a per-CPU task is dispatched to the local
DSQ of the onlined CPU before the hotplug event is received.

Signed-off-by: David Vernet <[email protected]>
@Byte-Lab Byte-Lab merged commit 918cd48 into sched_ext May 5, 2024
1 check passed
@Byte-Lab Byte-Lab deleted the hotplug_online branch May 5, 2024 03:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants