balance_dir...imited_flags(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… balance_dirty_pages_ratelimited_flags β€” a Kernel API Manual moment ✨

okay so before we even start, bestie, this is a page from the Kernel API Manual, section 9, and the star of the show is balance_dirty_pages_ratelimited_flags β€” yes the name is a whole entire mouthful, we love her anyway πŸŽ€


✨ NAME ✨

balance_dirty_pages_ratelimited_flags β€” literally just Balance dirty memory state. that's it, that's the elevator pitch 🫢


🌸 SYNOPSIS 🌸

int balance_dirty_pages_ratelimited_flags (struct address_space *mapping
, unsigned int flags );

like, she takes a mapping and some flags and hands you back an int. iconic signature ngl πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • mapping β€” the address_space which was dirtied. that's the vibe, that's the thing you got messy πŸ“
  • flags β€” BDP flags. yes they're just called BDP flags, no further notes, we move 😭

πŸ’– DESCRIPTION πŸ’–

so here's the tea. any process that's dirtying memory should call in here once for each page which was newly dirtied. one call, one freshly-dirtied page, that's the deal fr fr.

and then? the function will periodically check the system's dirty state and will initiate writeback if needed. she's like a little roomba for your dirty pages, checking in on a schedule, kicking off writeback when things get too messy ✨

also, heads up bestie β€” the manpage says to see balance_dirty_pages_ratelimited for details, so if you want the full lore, that's where it's at πŸ‘‘

🌈 RETURN 🌈

okay so this is where it actually matters, pay attention πŸ’€

  • if flags contains BDP_ASYNC, she may return -EAGAIN β€” which is the code for "memory is out of balance and the caller must wait for I/O to complete". so like, you gotta go wait, no cutting the line πŸ™ˆ
  • otherwise, she returns 0 β€” and that 0 means either memory was already in balance, or she was able to sleep until the amount of dirty memory returned to balance. either way, balanced, slay, we love a clean exit πŸŽ€

⭐ SEE ALSO ⭐

she lives in the kernel file ./mm/page-writeback.c and she has a whole friend group, look at this roster πŸ”₯

all of them are (9) girls, we stan a consistent section number πŸ’œ


πŸ’€ tiny reminder that this is all coming at you from ./mm, dated October 2026, so go read the source if you need more, bestie.

mwah, go balance some dirty pages, ily, bye πŸ§šπŸ’–

πŸ“¦ where this page comes from