-
Notifications
You must be signed in to change notification settings - Fork 39
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_flatcg: Keep cgroup rb nodes stashed #33
Conversation
Note: I have validated this against an older |
LGTM, please merge once tested. Thanks. |
This PR has been sitting as the series it depends on didn't make it into 6.7. It's in |
The flatcg scheduler uses a rb_node type - struct cgv_node - to keep track of vtime. On cgroup init, a cgv_node is created and stashed in a hashmap - cgv_node_stash - for later use. In cgroup_enqueued and try_pick_next_cgroup, the node is inserted into the rbtree, which required removing it from the stash before this patch's changes. This patch makes cgv_node refcounted, which allows keeping it in the stash for the entirety of the cgroup's lifetime. Unnecessary bpf_kptr_xchg's and other boilerplate can be removed as a result. Note that in addition to bpf_refcount patches, which have been upstream for quite some time, this change depends on a more recent series [0]. [0]: https://lore.kernel.org/bpf/20231107085639.3016113-1-davemarchevsky@fb.com/ Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
919edeb
to
3b7f33e
Compare
6.8 has been cut, rebased + addressed nit. Think this is good-to-go |
Would this work with the currently packaged kernels on arch and ubuntu? |
@htejun Looks like @arighi 's ubuntu kernel has backported the necessary series - it contains Since 6.8 has only been out for a day, shall we wait a bit for CachyOS folks to update before poking / trying to submit a PR? |
Yeah, let's wait a bit more so that the released kernels have the support. @jordalgo, how about fedora? What's the version situation there? |
@htejun Still working on both the c-schedulers package and I plan on starting on the actual kernel changes this week or next. |
6.8 will land on 13.03.2024 from our side. Everything seems fine so far. |
Looks like the packaged kernels should be ready by the time scx is packaged the next time. Merging now. Thanks. |
The flatcg scheduler uses a rb_node type - struct cgv_node - to keep track of vtime. On cgroup init, a cgv_node is created and stashed in a hashmap - cgv_node_stash - for later use. In cgroup_enqueued and try_pick_next_cgroup, the node is inserted into the rbtree, which required removing it from the stash before this patch's changes.
This patch makes cgv_node refcounted, which allows keeping it in the stash for the entirety of the cgroup's lifetime. Unnecessary bpf_kptr_xchg's and other boilerplate can be removed as a result.
Note that in addition to bpf_refcount patches, which have been upstream for quite some time, this change depends on a more recent series 0.