__wb_calc_thresh(9)
π
__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β thedirty_throttle_contextof interest, like the one you actually care about πthreshβ the dirty throttling or dirty background threshold ofwb_domaininsidedtc, 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
- 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