folio_is_file_lru(9)
β¨ folio_is_file_lru β the Kernel API Manual tea π«
okay bestie, gather round, because today we're learning about folio_is_file_lru from the Kernel API Manual and honestly? it's giving "tiny function, big responsibilities" π
πΈ NAME πΈ
folio_is_file_lru β so likeβ¦ should this folio be chilling on the file LRU, or the anon LRU? that's the whole question, no cap π
π¦ SYNOPSIS π¦
int folio_is_file_lru (const struct folio *folio );
literally just one argument and she returns an int. iconic minimalism β¨
π ARGUMENTS π
folioβ the folio we're testing. that's it. that's the whole input. she's the main character here π
π DESCRIPTION π
so here's the vibe: we would love to get this info without a page flag, but the state needs to survive until the folio is last deleted from the LRU π and that could be, like, way far down β as far down as __page_cache_release. yes bestie, that deep. so we can't just skip the flag, the state has to stick around that long fr fr.
π₯ RETURN π₯
she returns an integer β and not a boolean! (not me stressing this, but the manpage stresses it so I'm stressing it too π). it's used to sort a folio onto the right LRU list and to account folios correctly. here's the breakdown:
1β if the folio is a regular filesystem backed page cache folio, or a lazily freed anonymous folio (e.g. viaMADV_FREE). slay π0β if the folio is a normal anonymous folio, a tmpfs folio, or otherwise ram or swap backed folio. also valid, just different vibes π«Ά
lowkey important: integer, not boolean.1and0are doing real semantic work here, not just yes/no energy. respect it π
π§ SEE ALSO π§
- Kernel file
./include/linux/mm_inline.h __folio_clear_lru_flags(9)folio_lru_list(9)num_pages_contiguous(9)
go read those too, iykyk π
okay that's the whole page bestie, you ate that πβ¨ and for the cute sign-off: this little beauty comes from ./include/linux and is dated October 2026 β mark your calendars, the future is now π
ππΈ
π¦ 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