feat: add priority-share admission control - #134
Open
andylokandy wants to merge 8 commits into
Open
Conversation
andylokandy
force-pushed
the
feat/priority-share-admission
branch
from
August 2, 2026 10:09
4568bd5 to
df9f159
Compare
andylokandy
force-pushed
the
feat/priority-share-admission
branch
from
August 2, 2026 11:42
df9f159 to
8da918c
Compare
tisonkun
reviewed
Aug 2, 2026
tisonkun
reviewed
Aug 2, 2026
tisonkun
reviewed
Aug 2, 2026
tisonkun
left a comment
Collaborator
There was a problem hiding this comment.
Under this design we may merge FairShare into PriorityShare because FairShare::new(n) is semantically identicial to PriorityShare::new([n]).
andylokandy
marked this pull request as ready for review
August 4, 2026 12:44
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.
Summary
admission::PriorityShareas priority-bound handles over one shared capacity.FairShareas the equivalent single-priority policy over the same scheduler.Compatibility note: this removes the public
FairShare::num_waiters()method introduced in v0.6.5.Design Notes
Priorities are dense zero-based values ordered from lowest to highest. The constructor returns one handle per configured priority, and acquisition methods use the priority bound to that handle.
Capacity entries represent incremental headroom. The admission limit for priority
pis the sum of entries throughp, while every assigned permit counts toward every applicable shared threshold. For example, with[4, 1], priority 0 can enter while fewer than four permits are assigned, and priority 1 while fewer than five are assigned.When capacity is released, the highest eligible priority is admitted first. Within that priority, the owner holding the fewest permits across all priorities is selected; ties follow queue order. The same owner may acquire or wait at multiple priorities.
Assigned permits are never revoked. Sustained higher-priority demand may starve lower priorities, and reserved headroom may remain unused while lower-priority work waits.
PriorityShare::available_permits()is scoped to its handle’s priority. Values from different handles overlap and must not be added together; the highest-priority handle reports total unassigned capacity.