From 8cb1b0abcaa20bc325249252fe80b72636358555 Mon Sep 17 00:00:00 2001 From: Riccardo Pizzetti and Samuele Zecchini Date: Sun, 7 Jun 2015 02:37:51 +0200 Subject: [PATCH 2/2] block: Switch from BFQ-v7r7 for 3.4.0 to BFQ-v7r8 for 3.4.0 - second part . BUGFIX: Reduce the idling slice for seeky queues only if the scenario is symmetric. Before this fix, a seeky queue was unconditionally assigned only a very small idling slice, for throughput issues. Unfortunately, this could cause a process associated with a seeky queue to fail to receive its reserved share of the throughput. Specifically, it might happen if there were other processes with a lower weight, but associated to non-seeky queues. This commit addresses this issue by allowing the idling slice to be reduced for a seeky queue only if the scenario is symmetric. Signed-off-by: Riccardo Pizzetti Signed-off-by: Samuele Zecchini Signed-off-by: Arianna Avanzini Acked-by: Paolo Valente --- block/bfq-iosched.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 4702abe..637c906 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -177,6 +177,20 @@ static inline void bfq_schedule_dispatch(struct bfq_data *bfqd); #define bfq_sample_valid(samples) ((samples) > 80) /* + * The following macro groups conditions that need to be evaluated when + * checking if existing queues and groups form a symmetric scenario + * and therefore idling can be reduced or disabled for some of the + * queues. See the comment to the function bfq_bfqq_must_not_expire() + * for further details. + */ +#ifdef CONFIG_CGROUP_BFQIO +#define symmetric_scenario (!bfqd->active_numerous_groups && \ + !bfq_differentiated_weights(bfqd)) +#else +#define symmetric_scenario (!bfq_differentiated_weights(bfqd)) +#endif + +/* * We regard a request as SYNC, if either it's a read or has the SYNC bit * set (in which case it could also be a direct WRITE). */ @@ -1699,14 +1713,16 @@ static void bfq_arm_slice_timer(struct bfq_data *bfqd) */ sl = bfqd->bfq_slice_idle; /* - * Unless the queue is being weight-raised, grant only minimum idle - * time if the queue either has been seeky for long enough or has - * already proved to be constantly seeky. + * Unless the queue is being weight-raised or the scenario is + * asymmetric, grant only minimum idle time if the queue either + * has been seeky for long enough or has already proved to be + * constantly seeky. */ if (bfq_sample_valid(bfqq->seek_samples) && ((BFQQ_SEEKY(bfqq) && bfqq->entity.service > bfq_max_budget(bfqq->bfqd) / 8) || - bfq_bfqq_constantly_seeky(bfqq)) && bfqq->wr_coeff == 1) + bfq_bfqq_constantly_seeky(bfqq)) && bfqq->wr_coeff == 1 && + symmetric_scenario) sl = min(sl, msecs_to_jiffies(BFQ_MIN_TT)); else if (bfqq->wr_coeff > 1) sl = sl * 3; @@ -2465,12 +2481,6 @@ static inline int bfq_may_expire_for_budg_timeout(struct bfq_queue *bfqq) static inline bool bfq_bfqq_must_not_expire(struct bfq_queue *bfqq) { struct bfq_data *bfqd = bfqq->bfqd; -#ifdef CONFIG_CGROUP_BFQIO -#define symmetric_scenario (!bfqd->active_numerous_groups && \ - !bfq_differentiated_weights(bfqd)) -#else -#define symmetric_scenario (!bfq_differentiated_weights(bfqd)) -#endif #define cond_for_seeky_on_ncq_hdd (bfq_bfqq_constantly_seeky(bfqq) && \ bfqd->busy_in_flight_queues == \ bfqd->const_seeky_busy_in_flight_queues) -- 2.1.4