Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

scx_flatcg: Keep cgroup rb nodes stashed #168

Merged
merged 1 commit into from
Mar 28, 2024
Merged

scx_flatcg: Keep cgroup rb nodes stashed #168

merged 1 commit into from
Mar 28, 2024

Conversation

htejun
Copy link
Collaborator

@htejun htejun commented Mar 28, 2024

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.

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/[email protected]/

Signed-off-by: Dave Marchevsky <[email protected]>
@htejun htejun requested a review from Byte-Lab March 28, 2024 21:16
@htejun htejun merged commit e227931 into sched_ext Mar 28, 2024
1 check passed
@htejun htejun deleted the sync-from-scx branch March 28, 2024 23:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants