-
Notifications
You must be signed in to change notification settings - Fork 140
layered: improve compat of excl fixes on older kernels #1933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
layered: improve compat of excl fixes on older kernels #1933
Conversation
@@ -1856,27 +1856,20 @@ bool try_consume_layers(u32 *layer_order, u32 nr, u32 exclude_layer_id, | |||
return false; | |||
} | |||
|
|||
void BPF_STRUCT_OPS(layered_dispatch, s32 cpu, struct task_struct *prev) | |||
int sib_keep_idle(s32 cpu, struct task_struct *prev __arg_trusted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make it return bool and also take cpuc
?
|
||
/* !NULL prev_taskc indicates runnable prev */ | ||
if (prev && (prev->scx.flags & SCX_TASK_QUEUED)) { | ||
if (!(prev_taskc = lookup_task_ctx(prev)) || | ||
!(prev_layer = lookup_layer(prev_taskc->layer_id))) | ||
return; | ||
return 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't really matter but let's return false
here, just so that the default return is a more passive one.
@@ -1890,9 +1879,31 @@ void BPF_STRUCT_OPS(layered_dispatch, s32 cpu, struct task_struct *prev) | |||
if ((sib = sibling_cpu(cpu)) >= 0 && (sib_cpuc = lookup_cpu_ctx(sib)) && | |||
(sib_cpuc->current_excl || sib_cpuc->next_excl)) { | |||
gstat_inc(GSTAT_EXCL_IDLE, cpuc); | |||
return; | |||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this should be true.
} | ||
} | ||
|
||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and then false.
if (antistall_consume(cpuc)) | ||
return; | ||
|
||
if (prev && !sib_keep_idle(cpu, prev, cpuc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without !. Otherwise, it's really confusing.
improve compat of excl fixes on older kernels
older verifiers need the extra check on prev_layer and pulling out sib_keep_idle to reduce complexity (instruction count).