函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\page-writeback.c Create Date:2022-07-27 15:34:09
Last Modify:2022-05-23 13:25:58 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:alance_dirty_pages() must be called by processes which are generating dirty* data

函数原型:static void balance_dirty_pages(struct bdi_writeback *wb, unsigned long pages_dirtied)

返回类型:void

参数:

类型参数名称
struct bdi_writeback *wb
unsigned longpages_dirtied
1564  struct dirty_throttle_control gdtc_stor = {GDTC_INIT(wb)}
1565  struct dirty_throttle_control mdtc_stor = {MDTC_INIT(wb, & gdtc_stor)}
1566  gdtc等于gdtc_stor
1567  struct dirty_throttle_control * const mdtc = mdtc_valid( & mdtc_stor) ? & mdtc_stor : NULL
1576  bool dirty_exceeded = false
1579  bdi等于ur parent bdi
1580  strictlimit等于 Device capabilities 按位与BDI_CAP_STRICTLIMIT
1581  start_time等于jiffies
1583  循环
1584  now等于jiffies
1586  m_dirty等于0
1587  m_thresh等于0
1588  m_bg_thresh等于0
1596  nr_reclaimable等于global_node_page_state(NR_FILE_DIRTY)加global_node_page_state(NR_UNSTABLE_NFS)
1598  dirtyable 等于global_dirtyable_memory - number of globally dirtyable pages* Return: the global number of pages potentially available for dirty* page cache. This is the base value for the global dirty limits.
1599  le_dirty + write + nfs 等于nr_reclaimableglobal_node_page_state(NR_WRITEBACK)
1601  domain_dirty_limits - calculate thresh and bg_thresh for a wb_domain*@dtc: dirty_throttle_control of interest* Calculate @dtc->thresh and ->bg_thresh considering* vm_dirty_{bytes|ratio} and dirty_background_{bytes|ratio}. The caller
1607  thresh等于wb_thresh
1608  bg_thresh等于wb_bg_thresh
1609  否则
1615  如果mdtc
1634  否则
1653  如果dirty小于等于dirty_freerun_ceiling(thresh, bg_thresh)且非mdtcm_dirty小于等于dirty_freerun_ceiling(m_thresh, m_bg_thresh)的值则
1657  m_intv等于ULONG_MAX
1659  dirty_paused_when等于now
1660  nr_dirtied等于0
1664  退出
1667  如果此条件成立可能性小(为编译器优化)(!writeback_in_progress - determine whether there is writeback in progress*@wb: bdi_writeback of interest* Determine whether there is writeback waiting to be handled against a* bdi_writeback.)则wb_start_background_writeback - start background writeback*@wb: bdi_writback to write from* Description:* This makes sure WB_SYNC_NONE background writeback happens. When* this function returns, it is only guaranteed that for given wb
1670  mem_cgroup_flush_foreign(wb)
1676  如果非strictlimitwb_dirty_limits(gdtc)
1679  dirty_exceeded等于per-wb counterparts 大于wb_threshle_dirty + write + nfs 大于dirty threshold strictlimit的值
1682  Dirty position control
1683  sdtc等于gdtc
1685  如果mdtc
1692  如果非strictlimitwb_dirty_limits(mdtc)
1699  如果pos_ratio小于pos_ratiosdtc等于mdtc
1703  如果dirty_exceeded且非dirty_exceededdirty_exceeded等于1
1708  加自旋锁
1714  dirty_ratelimit等于The base dirty throttle rate, re-calculated on every 200ms.* All the bdi tasks' dirty rate will be curbed under it.*@dirty_ratelimit tracks the estimated @balanced_dirty_ratelimit* in small steps and is much more smooth/stable than the latter.
1715  task_ratelimit等于dirty_ratelimitpos_ratio右移RATELIMIT_CALC_SHIFT
1717  max_pause等于wb_max_pause(wb, per-wb counterparts )
1718  min_pause等于wb_min_pause(wb, max_pause, task_ratelimit, dirty_ratelimit, & nr_dirtied_pause)
1723  period等于max_pause
1724  pause等于max_pause
1725  转到:pause
1727  period等于HZpages_dirtiedtask_ratelimit
1728  pause等于period
1729  如果dirty_paused_whenpause减等于nowdirty_paused_when
1738  如果pause小于min_pause
1751  如果pause小于负HZ
1752  dirty_paused_when等于now
1753  nr_dirtied等于0
1754  否则如果period
1755  dirty_paused_when加等于period
1756  nr_dirtied等于0
1757  否则如果nr_dirtied_pause小于等于pages_dirtiednr_dirtied_pause加等于pages_dirtied
1759  退出
1764  pause等于max_pause
1767  pause :
1768  trace_balance_dirty_pages(wb, dirty threshold , dirty background threshold , le_dirty + write + nfs , wb_thresh, per-wb counterparts , dirty_ratelimit, task_ratelimit, pages_dirtied, period, pause, start_time)
1780  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (Convenience macros for the sake of set_current_state: )
1781  last wait 等于now
1782  This task is about to go to sleep on IO. Increment rq->nr_iowait so* that process accounting knows that this is a task in IO wait state.
1784  dirty_paused_when等于nowpause
1785  nr_dirtied等于0
1786  nr_dirtied_pause等于nr_dirtied_pause
1792  如果task_ratelimit退出
1805  如果per-wb counterparts 小于等于maximal error of a stat counter.退出
1808  如果fatal_signal_pending(当前进程)则退出
1812  如果非dirty_exceededdirty_exceededdirty_exceeded等于0
1815  如果writeback_in_progress - determine whether there is writeback in progress*@wb: bdi_writeback of interest* Determine whether there is writeback waiting to be handled against a* bdi_writeback.则返回
1826  如果Flag that puts the machine in "laptop mode". Doubles as a timeout in jiffies:* a full sync is triggered after this time elapses without any disk activity.则返回
1829  如果nr_reclaimable大于dirty background threshold wb_start_background_writeback - start background writeback*@wb: bdi_writback to write from* Description:* This makes sure WB_SYNC_NONE background writeback happens. When* this function returns, it is only guaranteed that for given wb
调用者
名称描述
balance_dirty_pages_ratelimitedalance_dirty_pages_ratelimited - balance dirty memory state*@mapping: address_space which was dirtied* Processes which are dirtying memory should call in here once for each page* which was newly dirtied. The function will periodically check the system's