From 2355060197f0d4bad2fdc16ca667b6fc8574766a Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Wed, 1 Dec 2010 19:34:46 +0100 Subject: [PATCH] --- yaml --- r: 223455 b: refs/heads/master c: d1ae8ffdfaa16b2ab2e9346e81cf0ab6eaaae347 h: refs/heads/master i: 223453: 275f3f56cffd10916cac0c122f3c4587b99b06b9 223451: eb2282b6b28310955a29013af4f523ee9aee6199 223447: f56dcc35e260ef91e603b7cfc2f539141e1e31fb 223439: 3b02b34a0735d068f16be50ee814354e9e6a9b35 223423: 31c8376b6976d6e6af8d4aa01dfaf8fd86502976 v: v3 --- [refs] | 2 +- trunk/block/blk-throttle.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 30a9ecaf0043..b563ea197335 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5478755616ae2ef1ce144dded589b62b2a50d575 +refs/heads/master: d1ae8ffdfaa16b2ab2e9346e81cf0ab6eaaae347 diff --git a/trunk/block/blk-throttle.c b/trunk/block/blk-throttle.c index 004be80fd894..2d134b7c40a3 100644 --- a/trunk/block/blk-throttle.c +++ b/trunk/block/blk-throttle.c @@ -355,6 +355,12 @@ throtl_start_new_slice(struct throtl_data *td, struct throtl_grp *tg, bool rw) tg->slice_end[rw], jiffies); } +static inline void throtl_set_slice_end(struct throtl_data *td, + struct throtl_grp *tg, bool rw, unsigned long jiffy_end) +{ + tg->slice_end[rw] = roundup(jiffy_end, throtl_slice); +} + static inline void throtl_extend_slice(struct throtl_data *td, struct throtl_grp *tg, bool rw, unsigned long jiffy_end) { @@ -391,6 +397,16 @@ throtl_trim_slice(struct throtl_data *td, struct throtl_grp *tg, bool rw) if (throtl_slice_used(td, tg, rw)) return; + /* + * A bio has been dispatched. Also adjust slice_end. It might happen + * that initially cgroup limit was very low resulting in high + * slice_end, but later limit was bumped up and bio was dispached + * sooner, then we need to reduce slice_end. A high bogus slice_end + * is bad because it does not allow new slice to start. + */ + + throtl_set_slice_end(td, tg, rw, jiffies + throtl_slice); + time_elapsed = jiffies - tg->slice_start[rw]; nr_slices = time_elapsed / throtl_slice;