WATERMARK MODIFIERS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌊 Watermark modifiers πŸ’§

okay so this page is from the Kernel API Manual, section 9, and it's literally the lore drop on how allocation flags gatekeep the emergency reserves 🚨✨

πŸŽ€ controls access to emergency reserves πŸŽ€

bestie, this is the vibe check on who gets to touch the emergency stash when the system is fighting for its life. three flags, three whole personalities, let's go πŸ‘‘

  • __GFP_HIGH β€” this one is saying "i'm high-priority, let me through" πŸ’… it indicates that the caller is high-priority and that granting the request is necessary before the system can make forward progress. iconic behavior, honestly. for example: creating an IO context to clean pages, and requests from atomic context. iykyk 🌸
  • __GFP_MEMALLOC β€” the chaotic one πŸ’€ this allows access to all memory, which is why it has rules. it should only be used when the caller guarantees the allocation will allow more memory to be freed very shortly, e.g. process exiting or swapping. users either should be the MM, or be co-ordinating closely with the VM (e.g. swap over NFS) 🫢
okay but fr fr, users of this flag have to be extremely careful to not deplete the reserve completely, and they need to implement a throttling mechanism which controls the consumption of the reserve based on the amount of freed memory. no cap, this is the part where you don't get to be cute with it 😭 usage of a pre-allocated pool (e.g. mempool) should always be considered before using this flag. that's the whole rule. periodt πŸŽ€
  • __GFP_NOMEMALLOC β€” the bouncer flag 🚫✨ this is used to explicitly forbid access to emergency reserves. and the tea is: this takes precedence over the __GFP_MEMALLOC flag if both are set. so if they're both in the group chat, __GFP_NOMEMALLOC is the one who decides πŸ’…

πŸ‘€ SEE ALSO πŸ‘€

the required reading, no skipping πŸ“

  • Kernel file ./tools/include/linux/gfp_types.h
  • gfp_t(9)
  • Page mobility and placement hints(9)
  • Reclaim modifiers(9)
  • Action modifiers(9)
  • Useful GFP flag combinations(9)

πŸ¦‹ anyway that's the whole page, mwah πŸ’– it lives in ./tools/include/linux, dated October 2026 β€” go read the other GFP pages next, they all connect, it's giving a whole cinematic universe 🌈⭐

πŸ“¦ where this page comes from