Lines Matching defs:dtc

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