fsleep(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ fsleep(9) ✨

okay bestie so this is fsleep from the Kernel API Manual, and honestly? she's the friend who always picks the right outfit for the occasion πŸ’… β€” a flexible sleep that autoselects the best mechanism. no cap.


πŸ¦‹ SYNOPSIS

void fsleep (unsigned long usecs );

like, that's it. one arg. so clean of her πŸŽ€


🌸 ARGUMENTS

  • usecs β€” the sleep duration you're asking for, measured in microseconds. yes, *micro*seconds. she's precise like that 🫢

πŸ’– DESCRIPTION

so here's the whole vibe: fsleep scans the situation and picks the mechanism that gives you at most 25% slack on the sleep duration you asked for. maximum 25%, she's not about to let your timing drift off into the void 😭. and because she's got range, she does it with three different moves:

  • udelay loop for sleep durations <= 10 microseconds β€” because spinning up an hrtimer for a sleep that short is giving unnecessary overhead energy πŸ’€ and she is not about that.
  • usleep_range for sleep durations where using msleep would land you with slack bigger than 25%. note: this whole decision depends on the granularity of jiffies, so it's not a fixed rule, iykyk ⭐
  • msleep for literally all the other sleep durations. she saves the chill one for last πŸ”₯

πŸ™ˆ NOTE

real talk: when CONFIG_HIGH_RES_TIMERS is not set, every single sleep gets processed with the granularity of jiffies β€” and that means the slack might exceed 25%, especially for short sleep durations. so... vibe check your config before you come for her, bestie πŸ˜ŒπŸ’€

🌈 SEE ALSO

Kernel file ./include/linux/delay.h plus her whole friend group: mdelay(9), usleep_range(9), usleep_range_idle(9), ssleep(9) πŸ‘‘


anyway that's the whole page, mwah πŸ’œ β€” this iconic little number lives in ./include/linux and is dated October 2026. see u in the next sleep call, bestie 🧚✨

πŸ“¦ where this page comes from