thp_vma_allowable_orders(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… thp_vma_allowable_orders β€” the kernel API manual, bestie edition ✨

okay so real talk, this is a page from the Kernel API Manual and it's literally about figuring out which hugepage orders a vma is allowed to use. let's get into it 🫢


🌸 NAME 🌸

thp_vma_allowable_orders β€” determine hugepage orders that are allowed for vma

like, which hugepage orders can this vma actually have? that's the whole vibe check. πŸ’–


✨ SYNOPSIS ✨

unsigned long thp_vma_allowable_orders (struct vm_area_struct *vma ,
vm_flags_t vm_flags , enum tva_type type , unsigned long orders );

that's the signature, copy it exactly bestie, no typos, we don't do that here πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • vma β€” the vm area to check. this is the main character of the whole function ngl πŸ‘‘
  • vm_flags β€” use these vm_flags instead of vma->vm_flags. yes, it overrides the vma's own flags, that's the point πŸ¦‹
  • type β€” the TVA type. that's it, that's the description, it's giving mysterious πŸ™ˆ
  • orders β€” bitfield of all orders to consider. everything you want in the running πŸ“

πŸ’œ DESCRIPTION πŸ’œ

so what does it actually do? it calculates the intersection of the requested hugepage orders and the allowed hugepage orders for the provided vma. intersection. set math. she's a mathematician πŸ’…βœ¨

permitted orders are encoded as a set bit at the corresponding bit position β€” so:

  • bit-2 corresponds to order-2
  • bit-3 corresponds to order-3
  • etc, you get the pattern iykyk
⚠️ heads up: Order-0 is never considered a hugepage order. periodt. don't come for her about order-0, she said no πŸ’€

πŸ”₯ RETURN πŸ”₯

bitfield of orders allowed for hugepage in the vma. πŸŽ€

and if nothing's allowed? she returns 0 β€” 0 if no hugepage orders are allowed. no orders, no vibes, empty bitfield, we die 😭


🌈 SEE ALSO 🌈

kernel file ./include/linux/huge_mm.h, plus the whole friend group:

go read those too, they're iconic in their own right πŸ§šπŸ’–


okay that's the whole page bestie, you ate, go read some kernel headers πŸ’…

source and version: ./include/linux β€” dated October 2026. mwah, love u, bye 🫢✨

πŸ“¦ where this page comes from