Re: [RFC PATCH v14 0/4] blk-iocost: BPF struct_ops cost model
From: Tao Cui
Date: Tue Dec 01 2026 - 08:26:34 EST
Hello, Tejun,
在 2026/11/18 21:10, Tao Cui 写道:
> This series lets a BPF program take over the cost model of one
> device. The BPF model provides calc_cost() for charged IOs plus two
> transfer coefficients for the completion-time sizing, io.cost.model
> selects between the attached model and the builtin one, and enabling
> and disabling the controller stays with io.cost.qos.
>
> The builtin model is a linear formula derived from a handful of device
> parameters, and the right formula is device specific. A BPF model can
> be adapted to the device and updated without rebuilding the kernel.
I've been testing the model switching from this series locally. One
test runs two sequential 4K direct readers in the same cgroup, first
with model=linear, then switched to the BPF model.
With model=linear, both streams get priced as random by the cursor
heuristic and the cgroup builds up a large abs_vdebt; throughput drops
to about 2 MB/s. Switching to the BPF model prices the same streams
sequential and throughput goes back to around 30 MB/s.
The question is what happens to the per-iocg vtime state on the
switch. The debt and delays built up under the old model were priced
with coefficients that don't apply anymore, and paying them back can
keep the cgroup stalled for a long time. My current branch treats a
model switch as a fresh start: abs_vdebt and delay are cleared and
each active iocg's vtime is moved to the activation target budget, the
same one iocg_activate() gives a newly activated iocg.
I'd like to hear your opinion on this.
Thanks,
Tao