memalloc_noio_save(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ memalloc_noio_save β€” the Kernel API Manual era πŸ’…

okay so bestie, we're in the Kernel API Manual today and this one is called memalloc_noio_save. it's short, it's iconic, and it does exactly one thing but it does it flawlessly. no cap.


✨ NAME ✨

memalloc_noio_save β€” marks implicit GFP_NOIO allocation scope. literally that's the whole gig, and she ate. πŸŽ€


🌸 SYNOPSIS 🌸

unsigned int memalloc_noio_save (void );

look at her. not a single argument. main character energy fr fr. πŸ¦‹


πŸ“ ARGUMENTS πŸ“

  • void β€” no arguments. none. zero. the void is the vibe. no arguments, bestie, she needs nothing from you. πŸ’œ

πŸ’– DESCRIPTION πŸ’–

so here's the tea. this function marks the beginning of the GFP_NOIO allocation scope. think of it like putting up a little velvet rope at the entrance of the function, and everything after that rope is gonna behave differently.

once you're inside, all further allocations will implicitly drop the __GFP_IO flag β€” like, automatically, you don't gotta do a thing β€” and so they are safe for the IO critical section, from the allocation recursion point of view. 🫢

and when you're done? you do not just wander off. use memalloc_noio_restore to end the scope, and you pass it the flags that this function returned to you. yes, the returned value matters. keep it. treasure it. pass it back. 😭


🧚 CONTEXT 🧚

this function is safe to be used from any context. literally any. no gatekeeping, no "sorry you're in the wrong context" energy. she's flexible like that. 🌈


⭐ RETURN ⭐

returns the saved flags β€” and those are the exact flags you gotta pass to memalloc_noio_restore later. don't lose them, bestie, i'm begging πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

kernel file ./include/linux/sched/mm.h πŸ‘€ and then the whole friend group:

squad goals honestly. the save/restore duos are all matching outfits and i respect it. πŸ’€βœ¨


tiny reminder from your girl: every _save in this list has a _restore and if you forget the restore you're gonna have a bad time. not a threat, just facts. πŸ’…

okay that's the page!! sourced from ./include/linux/sched, dated October 2026, version vibes immaculate. mwah, go forth and scope responsibly πŸ§šπŸ’–πŸŽ€

πŸ“¦ where this page comes from