might_alloc(9)
π might_alloc(9) β a Kernel API Manual moment
okay so this is might_alloc, bestie, straight out of the Kernel API Manual β¨ she's a tiny function with big "i might do something" energy and honestly? iconic.
πΈ NAME πΈ
might_alloc β she marks possible allocation sites π literally that's the whole job.
π SYNOPSIS π
void might_alloc (gfp_t gfp_mask );
π¦ ARGUMENTS π¦
gfp_maskβ thegfp_tflags that would be used to allocate π like, if you were gonna allocate. which you might.
β¨ DESCRIPTION β¨
so she's similar to might_sleep and all those other annotations, right? π«Ά you drop her into functions that might allocate β but like, often don't π. she's the "no thoughts head empty" annotation, except she's actually doing important work.
here's the gag: without CONFIG_LOCKDEP, she compiles to nothing. literally nothing. zero. nada. π so if you're wondering where she went, check your config, bestie.
and she includes a conditional might_sleep β but only if gfp allows blocking. no blocking, no might_sleep. it's giving conditional queen π.
π SEE ALSO π
she lives in the kernel file ./include/linux/sched/mm.h and honestly her whole friend group is in there:
mmgrab(9)mmget(9)memalloc_flags_save(9)memalloc_noio_save(9)memalloc_noio_restore(9)memalloc_nofs_save(9)memalloc_nofs_restore(9)memalloc_noreclaim_save(9)memalloc_noreclaim_restore(9)memalloc_pin_save(9)memalloc_pin_restore(9)set_active_memcg(9)
like a whole little save/restore family reunion π go say hi.
that's the page, babe π§ this one came from ./include/linux/sched, dated October 2026 β mwah, slay, periodt π
β¨
π¦ 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