STRUCT FOLIO_BATCH(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct folio_batch(9) β€” Kernel API Manual πŸ’…

okay bestie, welcome to section 9 of the Kernel API Manual, and no, we are not gatekeeping today 🫢 today's main character is struct folio_batch, and honestly? it's giving "glorified group chat for folios." let's get into it ✨


πŸŽ€ NAME πŸŽ€

struct folio_batch β€” literally just A collection of folios. that's the whole vibe. a lil squad of folios, hanging out together πŸ’–


✨ SYNOPSIS ✨

bestie look at the fit, it's iconic:

struct folio_batch {
    unsigned char nr;
    unsigned char i;
    bool percpu_pvec_drained;
    struct folio *folios[FOLIO_BATCH_SIZE];
 };

not a single extra character invented, not a single one dropped. slay πŸ’…


🌈 Members 🌈

okay so the Members section is lowkey just vibes β€” the manpage doesn't list any members one by one here. no cap, that's it, that's the section. the members are living their truth in the synopsis above πŸ‘‘ (and if you need the tea on the individual sub-entries of struct folio_batch, that's a you-and-the-struct conversation, not a me-and-the-struct conversation πŸ™ˆ)


πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole point of the folio_batch is to amortise the cost of retrieving and operating on a set of folios. like, instead of doing the expensive lil song-and-dance once per folio, you batch it up and do it for the whole crew at once. efficiency queen 🧚✨ expense? amortised. cost? spread out. we love a financially responsible data structure πŸ’œ

the order of folios in the batch may be significant β€” and here's the receipt: delete_from_page_cache_batch. so do not be out here shuffling the squad like it's a playlist, because sometimes position genuinely matters 😭

also, some users of the folio_batch store "exceptional" entries in it β€” the problematic lil divas of the batch, if you will πŸ’€ β€” and those can be removed by calling folio_batch_remove_exceptionals. so if your batch has drama, there's a whole function for kicking the drama out. periodt 🌸


πŸ”₯ SEE ALSO πŸ”₯

iykyk β€” go read them, they're the supporting cast and they absolutely ate πŸ”₯πŸ‘‘


πŸ’€ quick reminder: nothing in this page is decorative, so don't come for me if you skipped the FOLIO_BATCH_SIZE in the synopsis β€” it's real, it's load-bearing, it's in the struct. respect the bracket, bestie.

and that's the whole page! this masterpiece lives in ./include/linux, stamped October 2026, and it's filed as struct folio_batch(9) β€” go forth and batch responsibly, bestie πŸ“πŸ’–βœ¨

πŸ“¦ where this page comes from