grab_cache_page_nowait(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– grab_cache_page_nowait(9) πŸ’–

okay so this is a page straight out of the Kernel API Manual and honestly? she's a baddie. her whole thing is grabbing you a locked page at an index in a cache and she does not wait around for anybody. periodt. ✨


🌸 SYNOPSIS 🌸

struct page * grab_cache_page_nowait (struct address_space *mapping ,
pgoff_t index );

like literally that's the whole signature bestie, no cap 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • mapping β€” the target address_space. that's the cache she's gonna go shopping in πŸ›οΈ
  • index β€” the page index, aka where in that cache your fave page lives πŸ”

✨ DESCRIPTION ✨

bestie. listen. this function returns a locked page at the given index in the given cache, and it'll create it if it needs to β€” but here's the iconique part: it does not wait if the page is locked, and it does not wait to reclaim memory. not me showing up, not getting what I want, and leaving πŸ˜­πŸ’…

it's built for speculative data generators β€” the kind where, if the page couldn't be grabbed, the data can just be regenerated. no drama, no hard feelings, we move. πŸ”₯

the way this is safe to call while you're holding the lock for another page?? main character energy fr fr πŸ‘‘

also lowkey important: it clears __GFP_FS when allocating the page so you don't recurse back into the fs and deadlock against the caller's locked page πŸ’€ like that's the whole reason, don't skip it.

ngl the "don't wait" part is the whole vibe β€” if you need waiting, this is not your girl πŸ™ˆ

🌈 SEE ALSO 🌈

she's got a whole friend group and they're all in the Kernel file ./include/linux/pagemap.h β€” go say hi πŸ¦‹


mwah πŸ’‹ this page shipped from ./include/linux, dated October 2026, and she ate, no crumbs. go grab a page (or don't wait for one) πŸ“πŸ§š

πŸ“¦ where this page comes from