blk_pm_runtime_init(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… blk_pm_runtime_init β€” the Kernel API Manual, bestie edition πŸŽ€

okay so this page is blk_pm_runtime_init(9) from the Kernel API Manual, and honestly? it's giving "tiny function, big responsibilities." let's get into it ✨


🌸 NAME 🌸

blk_pm_runtime_init β€” the Block layer runtime PM initialization routine. that's it, that's the name, no notes πŸ’…


✨ SYNOPSIS ✨

void blk_pm_runtime_init (struct request_queue *q , struct device *dev );

yup, that's the whole signature. void return, two pointers in, vibes out. 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • q β€” the queue of the device. like, the actual struct request_queue *, not a copy, not a vibe, the real one πŸ”₯
  • dev β€” the device the queue belongs to. q's other half, its main character partner πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does this thing actually do? it initializes the runtime-PM-related fields for q and starts auto suspend for dev. lowkey iconic of it. ⭐

here's the tea for drivers wanting to take advantage of request-based runtime PM β€” you call this function when all three of these are true:

  1. dev has been initialized βœ…
  2. its request queue q has been allocated βœ…
  3. runtime PM for it can not happen yet β€” either because it's disabled/forbidden, or because its usage_count > 0 βœ…
and in most cases? the driver should call this function before any I/O has taken place. like, do it early, bestie. don't be weird about it. πŸ™ˆ

this function handles setting things up using auto suspend for the device, and here's the spicy detail: the autosuspend delay is set to -1 to make runtime suspend impossible until an updated value is either set by the user or by the driver. so yeah, it's deliberately asleep-at-the-wheel until somebody gives it a real number πŸ’€

the good news: drivers do not need to touch other autosuspend settings. it's handled. you're free. go live your life 🌈

one more thing, and it's important so listen up: the block layer runtime PM is request based, so it only works for drivers that use request as their IO unit β€” not the ones that directly use bio's. periodt. 🧚


πŸ‘‘ SEE ALSO πŸ‘‘

go read the whole saga, it's a series πŸ’œ


and that's the page!! this one came from ./block, October 2026, and it's the blk_pm_runtime_init(9) entry in the Kernel API Manual β€” mwah, slay, see u in the group chat πŸ˜­πŸ’–πŸŒΈ

πŸ“¦ where this page comes from