From: Tao Cui <cui.tao@linux.dev>
To: tj@kernel.org, josef@toxicopanda.com, axboe@kernel.dk, hch@infradead.org
Cc: cgroups@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, cui.tao@linux.dev,
cuitao@kylinos.cn
Subject: [PATCH v2 0/4] blk-iocost: charge flushes and zone appends
Date: Wed, 16 Sep 2026 16:53:00 +0800 [thread overview]
Message-ID: <20260916085304.1080271-1-cui.tao@linux.dev> (raw)
From: Tao Cui <cuitao@kylinos.cn>
While testing iocost's weight-based throttling under concurrent IO,
we observed that a cgroup limited to 1% weight could issue an
unbounded number of flushes without being throttled: an fsync loop
produced ~510k flushes in 12s with cost.usage staying at zero the
entire time. The device was monopolized while iocost reported no
activity. On ext4, a write+fsync workload showed the same gap: the
write component was charged but the flush component was not.
The cause is that the builtin linear cost model defines coefficients
only for READ and WRITE. Standalone flushes (the dataless
REQ_OP_WRITE | REQ_PREFLUSH bios from blkdev_issue_flush()), zone
append requests on zoned devices, and the flush component of
data-bearing REQ_OP_WRITE | REQ_PREFLUSH bios (e.g. journal commits)
fall through to a cost of zero. Zone append completions are also
excluded from the latency statistics, so the vrate feedback loop
cannot respond to latency induced by zone append operations.
1/4: charge the flush component of any REQ_PREFLUSH bio (standalone
and pre-flush) as pageless random writes with one-page floor,
and skip the cursor update for dataless bios
2/4: charge zone appends as sequential writes; skip cursor update
(ZA bi_sector is zone start, not the actual write position)
3/4: count ZA completions in latency stats (vrate feedback)
4/4: fix stale comment referring to nonexistent aux_iocg
After this series, on the same 1%-weight cgroup:
- the fsync loop is limited to 24 flushes per 12s (matching the
expected budget for the hdd profile)
- 16000 zone appends on a zoned null_blk are charged 533264 usec
- on ext4, the write+fsync workload is correctly accounted through
the journal layer (~2.2us per flush, matching the ssd_fast
profile's page-cost floor)
- sequential read throughput is unchanged
Both v1 review findings (cursor corruption by dataless flushes,
missing charge for the PREFLUSH component of data-bearing writes)
are addressed in 1/4; see its changelog for details. Proper
flush-cost modeling with a dedicated coefficient will follow as a
separate RFC.
Tao Cui (4):
blk-iocost: charge flushes as pageless random writes
blk-iocost: charge zone appends as page-counted sequential writes
blk-iocost: account zone append completions in latency stats
blk-iocost: fix stale comment in ioc_rqos_throttle()
block/blk-iocost.c | 42 ++++++++++++++++++++++++++++++++-------
1 file changed, 35 insertions(+), 7 deletions(-)
--
2.43.0
next reply other threads:[~2026-09-16 8:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 8:53 Tao Cui [this message]
2026-09-16 8:53 ` [PATCH v2 1/4] blk-iocost: charge flushes as pageless random writes Tao Cui
2026-09-16 8:53 ` [PATCH v2 2/4] blk-iocost: charge zone appends as page-counted sequential writes Tao Cui
2026-09-16 8:53 ` [PATCH v2 3/4] blk-iocost: account zone append completions in latency stats Tao Cui
2026-09-16 8:53 ` [PATCH v2 4/4] blk-iocost: fix stale comment in ioc_rqos_throttle() Tao Cui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916085304.1080271-1-cui.tao@linux.dev \
--to=cui.tao@linux.dev \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=cuitao@kylinos.cn \
--cc=hch@infradead.org \
--cc=josef@toxicopanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®