WATERMARK MODIFIERS(9)
π 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_MEMALLOCflag if both are set. so if they're both in the group chat,__GFP_NOMEMALLOCis 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
- 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