Lines Matching full:dtc
127 struct dirty_throttle_control *gdtc; /* only set in memcg dtc's */
164 static bool mdtc_valid(struct dirty_throttle_control *dtc) in mdtc_valid() argument
166 return dtc->dom; in mdtc_valid()
169 static struct wb_domain *dtc_dom(struct dirty_throttle_control *dtc) in dtc_dom() argument
171 return dtc->dom; in dtc_dom()
218 static bool mdtc_valid(struct dirty_throttle_control *dtc) in mdtc_valid() argument
223 static struct wb_domain *dtc_dom(struct dirty_throttle_control *dtc) in dtc_dom() argument
380 * @dtc: dirty_throttle_control of interest
382 * Calculate @dtc->thresh and ->bg_thresh considering
384 * must ensure that @dtc->avail is set before calling this function. The
387 static void domain_dirty_limits(struct dirty_throttle_control *dtc) in domain_dirty_limits() argument
389 const unsigned long available_memory = dtc->avail; in domain_dirty_limits()
390 struct dirty_throttle_control *gdtc = mdtc_gdtc(dtc); in domain_dirty_limits()
400 /* gdtc is !NULL iff @dtc is for memcg domain */ in domain_dirty_limits()
444 dtc->thresh = thresh; in domain_dirty_limits()
445 dtc->bg_thresh = bg_thresh; in domain_dirty_limits()
756 * @dtc: dirty_throttle_context of interest
775 static unsigned long __wb_calc_thresh(struct dirty_throttle_control *dtc) in __wb_calc_thresh() argument
777 struct wb_domain *dom = dtc_dom(dtc); in __wb_calc_thresh()
778 unsigned long thresh = dtc->thresh; in __wb_calc_thresh()
786 fprop_fraction_percpu(&dom->completions, dtc->wb_completions, in __wb_calc_thresh()
793 wb_min_max_ratio(dtc->wb, &wb_min_ratio, &wb_max_ratio); in __wb_calc_thresh()
915 static void wb_position_ratio(struct dirty_throttle_control *dtc) in wb_position_ratio() argument
917 struct bdi_writeback *wb = dtc->wb; in wb_position_ratio()
919 unsigned long freerun = dirty_freerun_ceiling(dtc->thresh, dtc->bg_thresh); in wb_position_ratio()
920 unsigned long limit = hard_dirty_limit(dtc_dom(dtc), dtc->thresh); in wb_position_ratio()
921 unsigned long wb_thresh = dtc->wb_thresh; in wb_position_ratio()
929 dtc->pos_ratio = 0; in wb_position_ratio()
931 if (unlikely(dtc->dirty >= limit)) in wb_position_ratio()
940 pos_ratio = pos_ratio_polynom(setpoint, dtc->dirty, limit); in wb_position_ratio()
970 if (dtc->wb_dirty < 8) { in wb_position_ratio()
971 dtc->pos_ratio = min_t(long long, pos_ratio * 2, in wb_position_ratio()
976 if (dtc->wb_dirty >= wb_thresh) in wb_position_ratio()
980 dtc->wb_bg_thresh); in wb_position_ratio()
985 wb_pos_ratio = pos_ratio_polynom(wb_setpoint, dtc->wb_dirty, in wb_position_ratio()
1009 dtc->pos_ratio = min(pos_ratio, wb_pos_ratio); in wb_position_ratio()
1044 if (unlikely(wb_thresh > dtc->thresh)) in wb_position_ratio()
1045 wb_thresh = dtc->thresh; in wb_position_ratio()
1053 wb_thresh = max(wb_thresh, (limit - dtc->dirty) / 8); in wb_position_ratio()
1058 x = div_u64((u64)wb_thresh << 16, dtc->thresh | 1); in wb_position_ratio()
1068 span = (dtc->thresh - wb_thresh + 8 * write_bw) * (u64)x >> 16; in wb_position_ratio()
1071 if (dtc->wb_dirty < x_intercept - span / 4) { in wb_position_ratio()
1072 pos_ratio = div64_u64(pos_ratio * (x_intercept - dtc->wb_dirty), in wb_position_ratio()
1083 if (dtc->wb_dirty < x_intercept) { in wb_position_ratio()
1084 if (dtc->wb_dirty > x_intercept / 8) in wb_position_ratio()
1086 dtc->wb_dirty); in wb_position_ratio()
1091 dtc->pos_ratio = pos_ratio; in wb_position_ratio()
1144 static void update_dirty_limit(struct dirty_throttle_control *dtc) in update_dirty_limit() argument
1146 struct wb_domain *dom = dtc_dom(dtc); in update_dirty_limit()
1147 unsigned long thresh = dtc->thresh; in update_dirty_limit()
1163 thresh = max(thresh, dtc->dirty); in update_dirty_limit()
1173 static void domain_update_bandwidth(struct dirty_throttle_control *dtc, in domain_update_bandwidth() argument
1176 struct wb_domain *dom = dtc_dom(dtc); in domain_update_bandwidth()
1186 update_dirty_limit(dtc); in domain_update_bandwidth()
1198 static void wb_update_dirty_ratelimit(struct dirty_throttle_control *dtc, in wb_update_dirty_ratelimit() argument
1202 struct bdi_writeback *wb = dtc->wb; in wb_update_dirty_ratelimit()
1203 unsigned long dirty = dtc->dirty; in wb_update_dirty_ratelimit()
1204 unsigned long freerun = dirty_freerun_ceiling(dtc->thresh, dtc->bg_thresh); in wb_update_dirty_ratelimit()
1205 unsigned long limit = hard_dirty_limit(dtc_dom(dtc), dtc->thresh); in wb_update_dirty_ratelimit()
1226 dtc->pos_ratio >> RATELIMIT_CALC_SHIFT; in wb_update_dirty_ratelimit()
1315 dirty = dtc->wb_dirty; in wb_update_dirty_ratelimit()
1316 if (dtc->wb_dirty < 8) in wb_update_dirty_ratelimit()
1317 setpoint = dtc->wb_dirty + 1; in wb_update_dirty_ratelimit()
1319 setpoint = (dtc->wb_thresh + dtc->wb_bg_thresh) / 2; in wb_update_dirty_ratelimit()
1524 static inline void wb_dirty_limits(struct dirty_throttle_control *dtc) in wb_dirty_limits() argument
1526 struct bdi_writeback *wb = dtc->wb; in wb_dirty_limits()
1542 dtc->wb_thresh = __wb_calc_thresh(dtc); in wb_dirty_limits()
1543 dtc->wb_bg_thresh = dtc->thresh ? in wb_dirty_limits()
1544 div64_u64(dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) : 0; in wb_dirty_limits()
1556 if (dtc->wb_thresh < 2 * wb_stat_error()) { in wb_dirty_limits()
1558 dtc->wb_dirty = wb_reclaimable + wb_stat_sum(wb, WB_WRITEBACK); in wb_dirty_limits()
1561 dtc->wb_dirty = wb_reclaimable + wb_stat(wb, WB_WRITEBACK); in wb_dirty_limits()
1682 * global dtc by default. in balance_dirty_pages()
1743 /* throttle according to the chosen dtc */ in balance_dirty_pages()