memalloc_nofs_save(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… memalloc_nofs_save β€” the Kernel API Manual glow-up

okay so bestie, let me put you on to memalloc_nofs_save β€” it lives in the Kernel API Manual and it's literally the "hey, we're entering the no-FS zone" button ✨


🌸 NAME 🌸

memalloc_nofs_save β€” marks implicit GFP_NOFS allocation scope. that's it, that's the whole vibe πŸŽ€


✨ SYNOPSIS ✨

unsigned int memalloc_nofs_save (void );

like, she takes nothing and she gives you back an unsigned int. main character energy fr fr πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • void β€” no arguments. zero. nada. she doesn't want your parameters, she's booked and busy πŸ’…

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea πŸ“ β€” this function marks the beginning of the GFP_NOFS allocation scope.

while you're inside that scope, all further allocations will implicitly drop the __GFP_FS flag, which means they're safe for the FS critical section from the allocation recursion point of view. no cap, that's the whole point πŸ”₯

and when you're done? use memalloc_nofs_restore to end the scope, passing it the flags that this function returned to you. don't lose those flags, bestie, they're your ticket back out πŸ™ˆ


🌈 CONTEXT 🌈

this function is safe to be used from any context. any. literally any. she's flexible like that 🧚


⭐ RETURN ⭐

the saved flags, which you then pass to memalloc_nofs_restore. keep them safe, hand them back, everyone's happy 🫢


πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./include/linux/sched/mm.h

the whole friend group, in order, no gatekeeping:


and that's the page, bestie πŸ’œ this lil drop came from ./include/linux/sched, dated October 2026 β€” so when you cite it in your group chat, you know exactly which era it's from. slay, go save your flags 🌟

πŸ“¦ where this page comes from