blkiolatency_enable_work_fn(9)
π blkiolatency_enable_work_fn(9)
okay so bestie, this one lives in the Kernel API Manual (section 9, kernel-space flex π) and it's literally the little work-function that flips iolatency on or off for a device. tiny function, big responsibilities, we love to see it β¨
πΈ NAME πΈ
blkiolatency_enable_work_fn β enable or disable iolatency on the device π
π¦ SYNOPSIS π¦
void blkiolatency_enable_work_fn (struct work_struct *work );
that's it. that's the whole signature. no cap, she's demure, she's mindful π«Ά
β ARGUMENTS β
workβ theenable_workof theblk_iolatencyof interest π like, the specific one you're clocking, not just any rando work struct, okay?
π₯ DESCRIPTION π₯
okay so here's the lore π iolatency has to keep track of the number of in-flight IOs per cgroup. and the way that that is relatively expensive β it involves walking up the hierarchy twice for every IO π twice!! every single one!! so if iolatency is not enabled in any cgroup for the device, we want to disable the in-flight tracking. periodt, why do the work if nobody asked π
but here's the thing, and this is the part where you have to be careful bestie π¨ we have to make sure that the counting is balanced β we do not want to leak the in-flight counts by disabling accounting in the completion path while IOs are in flight. that would be a whole mess, like leaving the group chat without saying bye but with actual kernel consequences π
and the way this is achieved is by ensuring that no IO is in flight by freezing the queue while flipping ->enabled. icy behaviour, honestly π§ and since this requires a sleepable context, the ->enabled flipping is punted to this work function. yes ma'am, deferred to a workqueue because you cannot be sleeping wherever you happen to be. main character scheduling energy π
π SEE ALSO π
- Kernel file
./block/blk-iolatency.cβ go read the source, iykyk π
mwah π that's the whole page β source is ./block, dated October 2026, and she ate, no crumbs πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms