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: Make layered idle CPU selection topology aware #683

Merged
merged 4 commits into from
Sep 24, 2024

Conversation

hodgesds
Copy link
Contributor

Make scx_layered idle CPU selection topology aware. It first tries to select an idle CPU from the local LLC before attempting to select an idle CPU from the local node.

Make idle CPU selection topology aware.

Signed-off-by: Daniel Hodges <[email protected]>
}
bpf_cpumask_copy(pref_idle_cpumask, idle_cpumask);
bpf_cpumask_and(pref_idle_cpumask, cache_cpumask, pref_idle_cpumask);
bpf_cpumask_and(pref_idle_cpumask, layer_cpumask, pref_idle_cpumask);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is likely okay for now but cpumasks can become rather big and these cpumask manipulations can become expensive. Down the line, it probably would make sense to maintain these masks persistently in each layer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense and then we'd only have to update the masks when the layers change size.

@@ -1030,7 +1076,7 @@ static bool keep_running(struct cpu_ctx *cctx, struct task_struct *p)

/*
* If @p is in an open layer, keep running if there's any idle
* CPU. If confined, keep running iff the layer has idle CPUs.
* CPU. If confined, keep running if the layer has idle CPUs.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think iff is intentional, meaning if and only if.

Fix comment to be more accurate.

Signed-off-by: Daniel Hodges <[email protected]>
@hodgesds hodgesds merged commit 2805bb7 into sched-ext:main Sep 24, 2024
1 of 2 checks passed
@hodgesds hodgesds deleted the layered-idle-topo branch September 24, 2024 20:37
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