函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\blk-iocost.c Create Date:2022-07-27 19:24:19
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:ioc_timer_fn

函数原型:static void ioc_timer_fn(struct timer_list *timer)

返回类型:void

参数:

类型参数名称
struct timer_list *timer
1343  ioc等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(timer, structioc, timer)
1346  nr_surpluses等于0, nr_shortages等于0, nr_lagging等于0
1347  ppm_rthr等于MILLIONqos[QOS_RPPM]
1348  ppm_wthr等于MILLIONqos[QOS_WPPM]
1354  ioc_lat_stat(ioc, missed_ppm, & rq_wait_pct)
1357  spin_lock_irq( & lock)
1359  ake a snapshot of the current [v]time and vrate
1361  period_vtime等于vnowvtime starttime
1362  如果WARN_ON_ONCE(!period_vtime)则
1363  spin_unlock_irq( & lock)
1364  返回
1374  如果非waitqueue_active -- locklessly test for waiters on the queue*@wq_head: the waitqueue to test for waiters* returns true if the wait list is not empty* NOTE: this function is lockless and requires care, incorrect usage _will_且非atomic64_read( & abs_vdebt)且非was iocg idle this period? 则继续下一循环
1378  加自旋锁
1383  iocg_kick_waitq(iocg, & now)
1384  iocg_kick_delay(iocg, & now, 0)
1385  否则如果was iocg idle this period?
1387  last_inuse等于inuse
1392  自旋锁解锁
1394  commit_active_weights(ioc)
1405  vdone等于atomic64_read( & done_vtime)
1406  vtime等于atomic64_read( & * `vtime` is this iocg's vtime cursor which progresses as IOs are * issued. If lagging behind device vtime, the delta represents * the currently available IO budget. If runnning ahead, the * overage. * `vtime_done` is the same but progressed on completion )
1407  current_hweight(iocg, & hw_active, & hw_inuse)
1415  如果ppm_rthr不等于MILLIONppm_wthr不等于MILLION的值且非atomic_read( & use_delay)且Same as above, but does so with platform independent 64bit types.* These must be used when utilizing jiffies_64 (i.e. return value of* get_jiffies_64() (vtime, vdone)且Same as above, but does so with platform independent 64bit types.* These must be used when utilizing jiffies_64 (i.e. return value of* get_jiffies_64() (vtime, vnow - MAX_LAGGING_PERIODS * period_vtime)且time_before64(vdone, vnow - period_vtime)则nr_lagging自加
1423  如果waitqueue_active -- locklessly test for waiters on the queue*@wq_head: the waitqueue to test for waiters* returns true if the wait list is not empty* NOTE: this function is lockless and requires care, incorrect usage _will_vusage等于vnowlast_vtime
1425  否则如果time_before64(last_vtime, vtime)则vusage等于vtimelast_vtime
1427  否则vusage等于0
1430  last_vtime加等于vusage
1436  vusage等于两数取大(vusage, vtime - vdone)
1439  如果vusage
1440  usage等于DIV64_U64_ROUND_UP(vusage * hw_inuse, period_vtime)
1442  usage is recorded as fractions of HWEIGHT_WHOLE 等于 usage is recorded as fractions of HWEIGHT_WHOLE 加1的和取模NR_USAGE_SLOTS
1443  usages[ usage is recorded as fractions of HWEIGHT_WHOLE ]等于usage
1444  否则
1445  usage等于0
1449  vmargin等于margin_usvrate
1450  vmin等于vnowvmargin
1452  has_surplus = false
1454  如果非waitqueue_active -- locklessly test for waiters on the queue*@wq_head: the waitqueue to test for waiters* returns true if the wait list is not empty* NOTE: this function is lockless and requires care, incorrect usage _will_time_before64(vtime, vmin)则
1456  delta等于vminvtime
1459  atomic64_add(delta, & * `vtime` is this iocg's vtime cursor which progresses as IOs are * issued. If lagging behind device vtime, the delta represents * the currently available IO budget. If runnning ahead, the * overage. * `vtime_done` is the same but progressed on completion )
1460  atomic64_add(delta, & done_vtime)
1461  last_vtime加等于delta
1464  has_surplus = true
1465  nr_surpluses自加
1467  否则如果hw_inuse小于hw_active
1472  new_hwi等于hw_active
1473  否则
1479  new_inuse等于div64_u64 - unsigned 64bit divide with 64bit divisor*@dividend: 64bit dividend*@divisor: 64bit divisor* This implementation is a modified version of the algorithm proposed* by the book 'Hacker's Delight'. The original source and full proof
1481  new_inuse等于clamp_t - return a value clamped to a given range using a given type*@type: the type of variable to use*@val: current value*@lo: minimum allowable value*@hi: maximum allowable value* This macro does no typechecking and uses temporary variables of type(u32, new_inuse, 1, active)
1483  如果new_inuse大于inuse
1490  否则
1492  nr_shortages自加
1496  如果非nr_shortages或非nr_surpluses则转到:skip_surplus_transfers
1502  nr_valid等于0
1504  如果非has_surplus则继续下一循环
1508 i小于NR_USAGE_SLOTS循环
1509  如果usages[i]则
1510  usage等于两数取大(usage, usages[i])
1511  nr_valid自加
1514  如果nr_valid小于MIN_VALID_USAGES则继续下一循环
1517  current_hweight(iocg, & hw_active, & hw_inuse)
1518  new_hwi等于rns usage with margin added if surplus is large enough
1519  如果非new_hwi则继续下一循环
1522  new_inuse等于DIV64_U64_ROUND_UP((u64)inuse * new_hwi, hw_inuse)
1524  如果new_inuse小于inuse
1525  TRACE_IOCG_PATH(inuse_giveaway, iocg, & now, inuse, new_inuse, hw_inuse, new_hwi)
1528  Update @iocg's `active` and `inuse` to @active and @inuse, update level* weight sums and propagate upwards accordingly.
1531  skip_surplus_transfers :
1532  commit_active_weights(ioc)
1540  prev_busy_level等于saturation history
1541  如果rq_wait_pct大于RQ_WAIT_BUSY_PCTmissed_ppm[generic data direction definitions ]大于ppm_rthrmissed_ppm[WRITE]大于ppm_wthr
1544  saturation history 等于两数取大(saturation history , 0)
1545  saturation history 自加
1546  否则如果rq_wait_pct小于等于RQ_WAIT_BUSY_PCTUNBUSY_THR_PCT除100且missed_ppm[generic data direction definitions ]小于等于ppm_rthrUNBUSY_THR_PCT除100且missed_ppm[WRITE]小于等于ppm_wthrUNBUSY_THR_PCT除100则
1550  如果nr_shortages且非nr_lagging
1553  如果非nr_surplusessaturation history 自减
1556  否则
1557  saturation history 等于0
1560  saturation history 等于clamp - return a value clamped to a given range with strict typechecking*@val: current value*@lo: lowest allowable value*@hi: highest allowable value* This macro does strict typechecking of @lo/@hi to make sure they are of the* same type as @val(saturation history , - 1000, 1000)
1562  如果saturation history 大于0或saturation history 小于0且非nr_lagging
1563  vrate等于atomic64_read( & vtime_rate)
1564  vrate_min等于vrate_min, vrate_max等于vrate_max
1567  如果rq_wait_pct大于RQ_WAIT_BUSY_PCTvrate_min等于VRATE_MIN
1575  如果vrate小于vrate_min
1579  否则如果vrate大于vrate_max
1583  否则
1588  如果saturation history 大于0则adj_pct等于100减adj_pct
1590  否则adj_pct等于100加adj_pct
1597  trace_iocost_ioc_vrate_adj(ioc, vrate, & missed_ppm, rq_wait_pct, nr_lagging, nr_shortages, nr_surpluses)
1601  atomic64_set( & vtime_rate, vrate)
1602  inuse_margin_vtime等于DIV64_U64_ROUND_UP(period_us * vrate * INUSE_MARGIN_PCT, 100)
1604  否则如果saturation history 不等于prev_busy_levelnr_lagging
1605  trace_iocost_ioc_vrate_adj(ioc, atomic64_read( & vtime_rate), & missed_ppm, rq_wait_pct, nr_lagging, nr_shortages, nr_surpluses)
1610  ioc_refresh_params(ioc, false)
1616  atomic64_inc( & c'd each period )
1618  如果running不等于IOC_STOP
1619  如果非链表为空
1620  ioc_start_period(ioc, & now)
1621  否则
1622  saturation history 等于0
1623  running等于IOC_IDLE
1627  spin_unlock_irq( & lock)