mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-30 10:55:03 +00:00
writeback: dirty position control - bdi reserve area
Keep a minimal pool of dirty pages for each bdi, so that the disk IO queues won't underrun. Also gently increase a small bdi_thresh to avoid it stuck in 0 for some light dirtied bdi. It's particularly useful for JBOD and small memory system. It may result in (pos_ratio > 1) at the setpoint and push the dirty pages high. This is more or less intended because the bdi is in the danger of IO queue underflow. Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
This commit is contained in:
parent
57fc978cfb
commit
8927f66c4e
1 changed files with 15 additions and 0 deletions
|
@ -599,6 +599,7 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi,
|
||||||
*/
|
*/
|
||||||
if (unlikely(bdi_thresh > thresh))
|
if (unlikely(bdi_thresh > thresh))
|
||||||
bdi_thresh = thresh;
|
bdi_thresh = thresh;
|
||||||
|
bdi_thresh = max(bdi_thresh, (limit - dirty) / 8);
|
||||||
/*
|
/*
|
||||||
* scale global setpoint to bdi's:
|
* scale global setpoint to bdi's:
|
||||||
* bdi_setpoint = setpoint * bdi_thresh / thresh
|
* bdi_setpoint = setpoint * bdi_thresh / thresh
|
||||||
|
@ -622,6 +623,20 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi,
|
||||||
} else
|
} else
|
||||||
pos_ratio /= 4;
|
pos_ratio /= 4;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bdi reserve area, safeguard against dirty pool underrun and disk idle
|
||||||
|
* It may push the desired control point of global dirty pages higher
|
||||||
|
* than setpoint.
|
||||||
|
*/
|
||||||
|
x_intercept = bdi_thresh / 2;
|
||||||
|
if (bdi_dirty < x_intercept) {
|
||||||
|
if (bdi_dirty > x_intercept / 8) {
|
||||||
|
pos_ratio *= x_intercept;
|
||||||
|
do_div(pos_ratio, bdi_dirty);
|
||||||
|
} else
|
||||||
|
pos_ratio *= 8;
|
||||||
|
}
|
||||||
|
|
||||||
return pos_ratio;
|
return pos_ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue