From: Hong Zhiguo <zhiguohong@xxxxxxxxxxx> Based on the discussion with Vivek, Tejun and Jens. Patch 1/2 implements basic token bucket rate limiting for blk-throttle. Patch 2/2 adjusts some behavior for the cases pointed out by Vivek: - A huge bio may be allowed immediately after a long time of idle - When token is trimmed for above case, should not trim ancestors when bio climbs up, instead, trim ancestors when bio is queued on lowest child group. Trimming of iops token is not necessary. Since a bio always costs _one_ iops token. Trimming it won't change the fact that current iops token is zero or not. I renamed "last_dispatch" back to "t_c"(Time Checkpoint, naming from network code) because now it's not only updated when a bio is dispatched. See patch 2/2. Thanks Vivek for the ancestor over-trim issue and the proposed solution. I took another method inspired by Vivek's comments but different. Please help to review it. Hong Zhiguo (2): blk-throttle: simplify logic by token bucket algorithm blk-throttle: trim tokens generated for an idle tree block/blk-throttle.c | 321 ++++++++++++++------------------------------------- 1 file changed, 87 insertions(+), 234 deletions(-) -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html