On Fri, 2011-08-26 at 09:56 +0800, Wu Fengguang wrote: > /* > * A linear estimation of the "balanced" throttle rate. The theory is, > * if there are N dd tasks, each throttled at task_ratelimit, the bdi's > * dirty_rate will be measured to be (N * task_ratelimit). So the below > * formula will yield the balanced rate limit (write_bw / N). > * > * Note that the expanded form is not a pure rate feedback: > * rate_(i+1) = rate_(i) * (write_bw / dirty_rate) (1) > * but also takes pos_ratio into account: > * rate_(i+1) = rate_(i) * (write_bw / dirty_rate) * pos_ratio (2) > * > * (1) is not realistic because pos_ratio also takes part in balancing > * the dirty rate. Consider the state > * pos_ratio = 0.5 (3) > * rate = 2 * (write_bw / N) (4) > * If (1) is used, it will stuck in that state! Because each dd will be > * throttled at > * task_ratelimit = pos_ratio * rate = (write_bw / N) (5) > * yielding > * dirty_rate = N * task_ratelimit = write_bw (6) > * put (6) into (1) we get > * rate_(i+1) = rate_(i) (7) > * > * So we end up using (2) to always keep > * rate_(i+1) ~= (write_bw / N) (8) > * regardless of the value of pos_ratio. As long as (8) is satisfied, > * pos_ratio is able to drive itself to 1.0, which is not only where > * the dirty count meet the setpoint, but also where the slope of > * pos_ratio is most flat and hence task_ratelimit is least fluctuated. > */ I'm still not buying this, it has the massive assumption N is a constant, without that assumption you get the same kind of thing you get from not adding pos_ratio to the feedback term. Also, I've yet to see what harm it does if you leave it out, all feedback loops should stabilize just fine. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html