DIV_ROUND_UP_POW2(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, welcome to the DIV_ROUND_UP_POW2(9) page in the Kernel API Manual β€” it’s giving β€œdivide and round up” and honestly it ate πŸ’…βœ¨


✨ NAME ✨

DIV_ROUND_UP_POW2 β€” divide and round up πŸŽ€


πŸ’… SYNOPSIS πŸ’…

DIV_ROUND_UP_POW2 (n , d );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • n β€” numerator 🌸
  • d β€” denominator (must be a power of 2). periodt, no cap πŸ’€

🌈 DESCRIPTION 🌈

So like, DIV_ROUND_UP_POW2 divides n by d and rounds up to the next multiple of d β€” and yes, d must be a power of 2, that part is literally not optional bestie πŸ™ˆπŸ’–

It avoids the integer overflows that may occur with __KERNEL_DIV_ROUND_UP 😭. Performance is roughly equivalent to __KERNEL_DIV_ROUND_UP, so it’s not sacrificing speed for the glow-up πŸ”₯


🫢 SEE ALSO 🫢

Kernel file ./include/linux/math.h, plus these icons: round_up(9), round_down(9), roundup(9), rounddown(9), abs(9), abs_diff(9), reciprocal_scale(9) ✨


source/version: ./include/linux Β· date: October 2026 β€” DIV_ROUND_UP_POW2(9) out πŸ’–πŸŽ€πŸ§š

πŸ“¦ where this page comes from