get_order(9)
get_order(9) π
okay bestie, welcome to the Kernel API Manual page for get_order β yes, the function name is literally the whole vibe. It's here to tell you the allocation order for a memory size, and we're gonna get into it.
β¨ NAME β¨
get_order β determine the allocation order of a memory size π
π SYNOPSIS π
int get_order (unsigned long size );
π¦ ARGUMENTS π¦
sizeβ the size for which you want to get the order. That's the whole input, bestie; hand it a size and it does its little logarithmic thing. π«Ά
π₯ DESCRIPTION π₯
so get_order determines the allocation order of a particular sized block of memory. It's on a logarithmic scale, and the mapping is giving:
0 -> 2^0 * PAGE_SIZE and below1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 12 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 13 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 14 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1...
The order that comes back is used to find the smallest allocation granule required to hold an object of the specified size. Very "smallest container that fits the fit" energy. π
β οΈ heads up, bestie: the result is undefined if the size is 0. Not "zero-ish", not "tiny", literally undefined. Don't do it. π
π SEE ALSO π
- Kernel file
./include/asm-generic/getorder.hπ
and that's the page, periodt. this cutie is sourced from ./include/asm-generic, dated October 2026, and it's serving get_order(9) realness. πβ¨
π¦ 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