Repository navigation
Conversation
added 3 commits
November 10, 2026 19:50
The existing rwstat formatter takes a blkg_policy_data pointer, although it only uses it to obtain the associated blkg. This unnecessarily ties statistics formatting to a policy. Introduce blkg_print_rwstat() to print rwstat samples directly from a blkg, allowing cgroup v1 I/O statistics to be reported independently of the throttle policy. Keep __blkg_prfill_rwstat() as a wrapper for existing policy users, including BFQ. The output format and total calculation remain unchanged. Signed-off-by: Zhe Liu <liuzhe1@kylinos.cn>
Cgroup v1 I/O statistics are currently stored in throtl_grp, making their allocation and lifetime dependent on the throttle policy. With lazy throttle initialization, these counters may not be available until an I/O limit is configured. Move the byte and I/O counters into an optional blkg-owned statistics object, independent of throttle activation. Allocate the counters for v1 and root blkgs to support late controller binding, while avoiding unnecessary allocations for non-root v2 blkgs. Move cgroup v1 statistics reporting, reset and offline propagation into the blkcg core. Add recursive aggregation for the optional statistics objects and preserve accumulated statistics when child blkgs are destroyed. Keep the existing userspace interfaces unchanged. Keep the accounting call site in blk_should_throtl(), routed through the new blkcg_account_v1_bio(). Moving accounting before the throttle activation check is handled in a separate patch. Signed-off-by: Zhe Liu <liuzhe1@kylinos.cn>
Commit a3166c5 ("blk-throttle: delay initialization until configuration") made throttle policy activation conditional on configuring a limit. However, blk_should_throtl() returns before updating the v1 counters when the policy is inactive. A cgroup v1 workload that only monitors I/O therefore gets no accounting until a limit is configured on the device. Now that the counters belong to the blkg, move their updates out of blk_should_throtl() and account immediately before blk_throtl_bio() in both submit_bio_noacct() and bio_submit_split_bioset(). This records I/O even when the throttle policy has never been activated. Keep BIO_CGROUP_ACCT byte deduplication and count each split-remainder submission as an I/O. Throttle worker dispatch continues to use the nocheck submission path, avoiding a second accounting update. The inline hierarchy check skips v1 accounting on cgroup v2. Fixes: a3166c5 ("blk-throttle: delay initialization until configuration") Signed-off-by: Zhe Liu <liuzhe1@kylinos.cn>
Author
|
Upstream branch: b3dfbde |
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.
Pull request for series with
subject: blkcg: decouple cgroup v1 I/O accounting from throttling
version: 1
url: https://patchwork.kernel.org/series/1207126/