__wb_calc_thresh(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __wb_calc_thresh(9) β€” a Kernel API Manual moment πŸŽ€

okay so bestie, welcome to the Kernel API Manual ✨ β€” this is __wb_calc_thresh(9) and it's genuinely iconic, let me tell you everything 🫢

✨ NAME ✨

__wb_calc_thresh β€” literally returns @wb's share of the dirty threshold πŸ’–

🌸 SYNOPSIS 🌸

unsigned long __wb_calc_thresh (struct dirty_throttle_control *dtc ,
unsigned long thresh );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • dtc β€” the dirty_throttle_context of interest, like the one you actually care about πŸ’…
  • thresh β€” the dirty throttling or dirty background threshold of wb_domain inside dtc, iykyk 🌈

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so this part is important, listen up πŸ“ β€” balance_dirty_pages will only seriously take the dirty throttling threshold as a hard limit when sleeping max_pause per page is not enough to keep the dirty pages under control. Like fr fr, only then. For example: when the device is completely stalled due to some error conditions 😭, or when there are 1000 dd tasks writing to a slow 10MB/s USB key πŸ’€. In the other normal situations, it acts more gently by throttling the tasks more (rather than completely block them) when the wb dirty pages go high 🌸.

It allocates high/low dirty limits to fast/slow devices, in order to prevent:

  • starving fast devices πŸ”₯
  • piling up dirty pages (that will take long time to sync) on slow devices πŸ™ˆ

The wb's share of dirty limit will be adapting to its throughput and bounded by the bdi->min_ratio and/or bdi->max_ratio parameters, if set ✨ (yes, "if set" β€” don't forget that part bestie 🫢).

⭐ RETURN ⭐

wb's dirty limit, in pages πŸ’–. For the dirty throttling limit, the term "dirty" in the context of dirty balancing includes all PG_dirty and PG_writeback pages β€” both of them, no cap πŸ‘‘

🌟 SEE ALSO 🌟

Kernel file ./mm/page-writeback.c and its whole friend group: node_dirtyable_memory(9), global_dirtyable_memory(9), domain_dirty_limits(9), global_dirty_limits(9), node_dirty_limit(9), node_dirty_ok(9), balance_dirty_pages_ratelimited_flags(9), balance_dirty_pages_ratelimited(9), wb_over_bg_thresh(9), tag_pages_for_writeback(9), writeback_iter(9), filemap_dirty_folio(9), folio_redirty_for_writepage(9), folio_mark_dirty(9), folio_wait_writeback(9), folio_wait_writeback_killable(9), folio_wait_stable(9) πŸŒˆπŸ’œ


ngl, go read those. they're giving main character energy and they're all in ./mm 🧚

and that's the whole page bestie, periodt πŸ’… β€” brought to you by ./mm, dated October 2026, and yeah it's __wb_calc_thresh(9) the whole way through πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from