Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\page-writeback.c Create Date:2022-07-28 14:10:34
Last Modify:2022-05-23 13:25:58 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:alance_dirty_pages() must be called by processes which are generating dirty* data

Proto:static void balance_dirty_pages(struct bdi_writeback *wb, unsigned long pages_dirtied)

Type:void

Parameter:

TypeParameterName
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  cycle
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_reclaimable + global_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
1609  Else
1615  If mdtc Then
1634  Else
1657  m_intv = ULONG_MAX
1660  nr_dirtied = 0
1664  Break
1667  If Value for the false possibility is greater at compile time(!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.) Then 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  If Not strictlimit Then wb_dirty_limits(gdtc)
1679  dirty_exceeded = per-wb counterparts > wb_thresh && ( le_dirty + write + nfs > dirty threshold || strictlimit)
1682  Dirty position control
1683  sdtc = gdtc
1685  If mdtc Then
1692  If Not strictlimit Then wb_dirty_limits(mdtc)
1699  If pos_ratio < pos_ratio Then sdtc = mdtc
1703  If dirty_exceeded && Not dirty_exceeded Then dirty_exceeded = 1
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_ratelimit * pos_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  Go to pause
1727  period = HZ * pages_dirtied / task_ratelimit
1728  pause = period
1729  If dirty_paused_when Then pause -= now - dirty_paused_when
1738  If pause < min_pause Then
1751  If pause < -HZ Then
1753  nr_dirtied = 0
1754  Else if period Then
1756  nr_dirtied = 0
1759  Break
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 = now + pause
1785  nr_dirtied = 0
1786  nr_dirtied_pause = nr_dirtied_pause
1792  If task_ratelimit Then Break
1805  If per-wb counterparts <= maximal error of a stat counter. Then Break
1808  If fatal_signal_pending(current process) Then Break
1812  If Not dirty_exceeded && dirty_exceeded Then dirty_exceeded = 0
1815  If 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. Then Return
1826  If 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. Then Return
1829  If nr_reclaimable > dirty background threshold Then 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
Caller
NameDescribe
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