Skip to content
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

scx_layered: Add helper for layer slice duration #918

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

hodgesds
Copy link
Contributor

Add a helper for returning the appropriate slice duration for a layer and replace a various instances where the slice value was being recalculated.

Add a helper for returning the appropriate slice duration for a layer
and replace a various instances where the slice value was being
recalculated.

Signed-off-by: Daniel Hodges <[email protected]>
if (vtime_before(vtime, layer->vtime_now - layer_slice_ns))
vtime = layer->vtime_now - layer_slice_ns;
if (vtime_before(vtime, layer->vtime_now - slice_ns))
vtime = layer->vtime_now - slice_ns;

/*
* Special-case per-cpu kthreads which aren't in a preempting layer so
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could potentially change the slice duration here as slice_ns variable is reused for kthreads. However, it should get set to the appropriate layers slice_ns vs the default which I think is reasonable.

Copy link
Contributor

@etsal etsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, assuming that the instance of slice_ns in main.bpf.c:1114 being shadowed by the new value is fine as you mention.

I would agree that it makes sense for the kthread to use the slice of the layer it's in. IMO if we were treating kthreads as a special case within the layer, then just passing them the standard slice would not be enough - we'd need a specific separate policy we can tune. In that case, we might as well put them in their own layer.

@hodgesds hodgesds added this pull request to the merge queue Nov 11, 2024
Merged via the queue into sched-ext:main with commit 6733168 Nov 11, 2024
23 checks passed
@hodgesds hodgesds deleted the layered-slice-helper branch November 11, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants