mirror of
https://github.com/JakeHillion/scx.git
synced 2024-11-26 11:30:22 +00:00
rusty: Check for offline CPU in rusty_dispatch()
There's currently a slight issue on existing kernels on the hotplug path wherein we can start to receive scheduling callbacks on a CPU before that CPU has received hotplug events. For CPUs going online, this can possibly confuse a scheduler because it may not be expecting anything to ever happen on that CPU, and therefore may do things that could cause the scheduler to crash. For example, without this patch in scx_rusty, we try to consume from a bogus DSQ that doesn't exist, which causes ext.c to boot out the scheduler. Though this issue will soon be fixed in ext.c, let's explicitly avoid dispatching from an onlining CPU in rusty so that we properly support hotplug on older kernels as well. Signed-off-by: David Vernet <void@manifault.com>
This commit is contained in:
parent
0d6b00238f
commit
6f1dc6067a
@ -1171,6 +1171,16 @@ void BPF_STRUCT_OPS(rusty_dispatch, s32 cpu, struct task_struct *prev)
|
||||
struct pcpu_ctx *pcpuc;
|
||||
u32 node_doms, my_node, i;
|
||||
|
||||
/*
|
||||
* In older kernels, we may receive an ops.dispatch() callback when a
|
||||
* CPU is coming online during a hotplug _before_ the hotplug callback
|
||||
* has been invoked. We're just going to exit in that hotplug callback,
|
||||
* so let's just defer consuming here to avoid triggering a bad DSQ
|
||||
* error in ext.c.
|
||||
*/
|
||||
if (unlikely(is_offline_cpu(cpu)))
|
||||
return;
|
||||
|
||||
if (scx_bpf_consume(dom)) {
|
||||
stat_add(RUSTY_STAT_DSQ_DISPATCH, 1);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user