blkiolatency_enable_work_fn(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the enable_work of the blk_iolatency of 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