Repository navigation
bpf.scx: compile minimal sched_ext schedulers - #81
Open
sneaky-potato wants to merge 5 commits into
Open
sneaky-potato wants to merge 5 commits into
sneaky-potato wants to merge 5 commits into
Conversation
A struct_ops object attaches to no device: the kernel registers it as a unit. The loader learns two verbs for it, beside the attach a program takes. `scheduler` answers whether the object carries a struct_ops map, which is how the CLI tells a scheduler from an xdp or tc program before it loads one. `register` attaches each struct_ops map with `bpf_map__attach_struct_ops` and pins its link as `<root>/<name>-link`, the way `attach` pins a program's, so the link holds the scheduler once the command has exited and `detach`, reading that `-link` pin, unregisters it with no change of its own. `load` stops pinning a struct_ops map: the pinned link holds the registration, as libbpf's own struct_ops skeletons leave the map to it, so pinning the map too would persist a second holder with nothing to open it. `bpf.scx`'s doc names the `lunatik run` path the CLI wires over this. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
bpf.scx writes a sched_ext scheduler, which `lunatik run` registers with no device, but the guide, written for device programs, says nothing of it. A Schedulers section now does: the minimal scheduler, a name and an init callback that returns 0; that it takes no device, so `lunatik run` takes no `--dev` and one given a scheduler is refused; that the run registers its struct_ops and pins the link that holds it, and the stop unregisters it; and that it compiles only where the kernel's BTF carries `sched_ext_ops`, a kernel built with CONFIG_SCHED_CLASS_EXT, 6.12 and later. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
bpf.scx.schedulerto compile a minimal scheduler with anameandinitcallback into a BPFstruct_opsobject. Read the scheduler layout from kernel BTF, emit the required sections and relocations, and add loader support to register the resulting scheduler. Document the API and its use.Related to #15