Conversation
Introduce a new per-cgroup file "cost.boost" that allows temporarily boosting an io.cost cgroup. Writing a duration in microseconds to the file enables boost mode for that cgroup. When a cgroup is boosted, iocost skips surplus evaluation for it and restores its inuse weight to active, ensuring the boosted cgroup keeps its full IO share during the boost period.
Reviewer's GuideIntroduces the non-root Sequence diagram for the io.cost.boost cgroup interfacesequenceDiagram
actor Admin
participant Cgroup as io.cost.boost
participant Iocost as ioc_cgrp
participant Timer as ioc_timer_fn
Admin->>Cgroup: write duration_us
Cgroup->>Iocost: kstrtou64(strim(buf), 10)
alt duration_us <= MAX_BOOST_US
Iocost->>Iocost: WRITE_ONCE(boost_deadline)
Admin->>Cgroup: read remaining duration
Cgroup->>Iocost: ktime_get_ns()
Iocost-->>Cgroup: remaining_us
else duration_us > MAX_BOOST_US
Cgroup-->>Admin: -EINVAL
end
Timer->>Iocost: READ_ONCE(boost_deadline)
alt boost_deadline > now.now_ns
Iocost->>Iocost: __propagate_weights(active, active, true, &now)
Iocost-->>Timer: skip surplus evaluation
else boost expired
Timer->>Timer: evaluate surplus
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="block/blk-iocost.c" line_range="2319-2331" />
<code_context>
usage_us = iocg->usage_delta_us;
usage_us_sum += usage_us;
+ /* skip surplus evaluation if this cgroup is boosted */
+ {
+ struct blkcg_gq *blkg = iocg_to_blkg(iocg);
+ struct ioc_cgrp *iocc = blkcg_to_iocc(blkg->blkcg);
+
+ if (READ_ONCE(iocc->boost_deadline) > now.now_ns) {
+ if (iocg->inuse != iocg->active &&
+ !iocg->abs_vdebt) {
+ __propagate_weights(iocg, iocg->active,
+ iocg->active, true,
+ &now);
+ }
+ continue;
+ }
+ }
</code_context>
<issue_to_address>
**issue (broader_impact):** Boosting a non-leaf cgroup does not preserve the cgroup's full hierarchical IO share: the timer skips surplus evaluation only for the boosted cgroup's own `iocg`, while its active child `iocg`s continue donating weight. When the parent is restored, `__propagate_weights()` derives an internal node's in-use weight from its children's reduced weights, so the boosted parent remains throttled.
**Triggers:** When the boosted cgroup has active child cgroups that have donated surplus weight.
**Suggested fix:** Propagate the boost to the active descendants, or restore the entire boosted subtree's in-use weights rather than only evaluating the cgroup whose `boost_deadline` is set.
</issue_to_address>| /* skip surplus evaluation if this cgroup is boosted */ | ||
| { | ||
| struct blkcg_gq *blkg = iocg_to_blkg(iocg); | ||
| struct ioc_cgrp *iocc = blkcg_to_iocc(blkg->blkcg); | ||
|
|
||
| if (READ_ONCE(iocc->boost_deadline) > now.now_ns) { | ||
| if (iocg->inuse != iocg->active && | ||
| !iocg->abs_vdebt) { | ||
| __propagate_weights(iocg, iocg->active, | ||
| iocg->active, true, | ||
| &now); | ||
| } | ||
| continue; |
There was a problem hiding this comment.
issue (broader_impact): Boosting a non-leaf cgroup does not preserve the cgroup's full hierarchical IO share: the timer skips surplus evaluation only for the boosted cgroup's own iocg, while its active child iocgs continue donating weight. When the parent is restored, __propagate_weights() derives an internal node's in-use weight from its children's reduced weights, so the boosted parent remains throttled.
Triggers: When the boosted cgroup has active child cgroups that have donated surplus weight.
Suggested fix: Propagate the boost to the active descendants, or restore the entire boosted subtree's in-use weights rather than only evaluating the cgroup whose boost_deadline is set.
Introduce a new per-cgroup file "io.cost.boost" that allows temporarily boosting an io.cost cgroup. Writing a duration in microseconds to the file enables boost mode for that cgroup. When a cgroup is boosted, iocost skips surplus evaluation for it and restores its inuse weight to active, ensuring the boosted cgroup keeps its full IO share during the boost period.
Summary by Sourcery
Add temporary per-cgroup IO cost boosting to preserve full IO shares for latency-sensitive workloads.
New Features:
Enhancements: