[RFC PATCH v9 4/4] docs: cgroup-v2: document the iocost BPF cost model attachment
From: Tao Cui
Date: Fri Oct 02 2026 - 21:34:39 EST
Document the BPF cost model attachment in the io.cost.model section
of the cgroup v2 documentation: attaching an iocost_model_ops
struct_ops to a device by its major:minor, the model=bpf readback
while attached (ctrl keeps describing the coefficients), that
detaching restores the builtin model, and that ctrl= writes never
select a model.
Suggested-by: Tejun Heo <tj@xxxxxxxxxx>
Signed-off-by: Tao Cui <cuitao@xxxxxxxxxx>
---
Documentation/admin-guide/cgroup-v2.rst | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
index 7fe950425216c..07da465bb4ef0 100644
--- a/Documentation/admin-guide/cgroup-v2.rst
+++ b/Documentation/admin-guide/cgroup-v2.rst
@@ -2117,8 +2117,31 @@ IO Interface Files
===== ================================
ctrl "auto" or "user"
model The cost model in use - "linear"
+ or "bpf" while the BPF model
+ is in use
===== ================================
+ When CONFIG_BLK_CGROUP_IOCOST_BPF is enabled, a BPF cost model
+ can be bound to a device by attaching an "iocost_model_ops"
+ struct_ops carrying the whole disk's major:minor in its "dev"
+ member (a partition's major:minor is rejected). Attaching creates
+ the
+ controller if needed, like an io.cost.model write does, and
+ switches the device's pricing to the model; enabling and
+ disabling the controller stays with io.cost.qos. While a model
+ is attached, "model" selects between it and the builtin model:
+ "model=bpf" switches to the attached model and "model=linear"
+ switches back to the builtin model, and neither detaches the
+ struct_ops; only detaching removes the model, after which
+ "model=bpf" fails and the device prices with the builtin model
+ again. Device removal ejects the attached model as well, while
+ the struct_ops link remains until userspace destroys it. "ctrl"
+ accepts only "auto" and "user" and never
+ selects a model; it keeps describing the builtin coefficients,
+ which are kept while the BPF model is in use and take effect
+ again when switched back, and the automatic profile stepping
+ does not switch profiles while the BPF model is in use.
+
When "ctrl" is "auto", the kernel may change all parameters
dynamically. When "ctrl" is set to "user" or any other
parameters are written to, "ctrl" become "user" and the
--
2.43.0