From a1fd1c0e6e61f018ce4e9eb7d9ac917e13b39b09 Mon Sep 17 00:00:00 2001 From: Paolo Valente Date: Tue, 11 Apr 2017 12:28:10 +0200 Subject: [PATCH 1/4] BUGFIX: Handle failure of weight-counter allocation Reported-by: Bart Van Assche Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 090cbab..7d252f1 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -474,6 +474,22 @@ static void bfq_weights_tree_add(struct bfq_data *bfqd, entity->weight_counter = kzalloc(sizeof(struct bfq_weight_counter), GFP_ATOMIC); + + /* + * In the unlucky event of an allocation failure, we just + * exit. This will cause the weight of entity to not be + * considered in bfq_differentiated_weights, which, in its + * turn, causes the scenario to be deemed wrongly symmetric in + * case entity's weight would have been the only weight making + * the scenario asymmetric. On the bright side, no unbalance + * will however occur when entity becomes inactive again (the + * invocation of this function is triggered by an activation + * of entity). In fact, bfq_weights_tree_remove does nothing + * if !entity->weight_counter. + */ + if (unlikely(!entity->weight_counter)) + return; + entity->weight_counter->weight = entity->weight; rb_link_node(&entity->weight_counter->weights_node, parent, new); rb_insert_color(&entity->weight_counter->weights_node, root); From 7c64bf3c0712aa08441d196e55c67c525fb9fa0e Mon Sep 17 00:00:00 2001 From: Paolo Valente Date: Tue, 11 Apr 2017 12:32:03 +0200 Subject: [PATCH 2/4] BUGFIX: Remove problematic check on max service duration Reported-by: Bart Van Assche Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 7d252f1..1e3d9ba 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -2922,8 +2922,8 @@ static bool bfq_bfqq_is_slow(struct bfq_data *bfqd, struct bfq_queue *bfqq, delta_ktime = ktime_sub(delta_ktime, bfqd->last_budget_start); delta_usecs = ktime_to_us(delta_ktime); - /* don't trust short/unrealistic values. */ - if (delta_usecs < 1000 || delta_usecs >= LONG_MAX) { + /* don't use too short time intervals */ + if (delta_usecs < 1000) { if (blk_queue_nonrot(bfqd->queue)) /* * give same worst-case guarantees as idling @@ -2933,7 +2933,7 @@ static bool bfq_bfqq_is_slow(struct bfq_data *bfqd, struct bfq_queue *bfqq, else /* charge at least one seek */ *delta_ms = bfq_slice_idle / NSEC_PER_MSEC; - bfq_log(bfqd, "bfq_bfqq_is_slow: unrealistic %u", delta_usecs); + bfq_log(bfqd, "bfq_bfqq_is_slow: too short %u", delta_usecs); return slow; } From 3ae7c6e4bb147ba950b5caf2ced1739c709c60e6 Mon Sep 17 00:00:00 2001 From: Paolo Valente Date: Tue, 11 Apr 2017 12:35:09 +0200 Subject: [PATCH 3/4] BFQ-v8r10-rc1 Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 +- block/bfq.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 1e3d9ba..540bd2d 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5257,7 +5257,7 @@ static struct blkcg_policy blkcg_policy_bfq = { static int __init bfq_init(void) { int ret; - char msg[60] = "BFQ I/O-scheduler: v8r9"; + char msg[60] = "BFQ I/O-scheduler: v8r10-rc1"; #ifdef CONFIG_BFQ_GROUP_IOSCHED ret = blkcg_policy_register(&blkcg_policy_bfq); diff --git a/block/bfq.h b/block/bfq.h index 4f7d0b8..0c73102 100644 --- a/block/bfq.h +++ b/block/bfq.h @@ -1,5 +1,5 @@ /* - * BFQ v8r9 for 4.10.0: data structures and common functions prototypes. + * BFQ v8r10-rc1 for 4.11.0: data structures and common functions prototypes. * * Based on ideas and code from CFQ: * Copyright (C) 2003 Jens Axboe From 277f5737b68ef9bea5eede7882da621edfa2381c Mon Sep 17 00:00:00 2001 From: Paolo Valente Date: Thu, 20 Apr 2017 09:46:53 +0200 Subject: [PATCH 4/4] BFQ-v8r10 Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 +- block/bfq.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 540bd2d..59b1891 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5257,7 +5257,7 @@ static struct blkcg_policy blkcg_policy_bfq = { static int __init bfq_init(void) { int ret; - char msg[60] = "BFQ I/O-scheduler: v8r10-rc1"; + char msg[60] = "BFQ I/O-scheduler: v8r10"; #ifdef CONFIG_BFQ_GROUP_IOSCHED ret = blkcg_policy_register(&blkcg_policy_bfq); diff --git a/block/bfq.h b/block/bfq.h index 0c73102..7cb3240 100644 --- a/block/bfq.h +++ b/block/bfq.h @@ -1,5 +1,5 @@ /* - * BFQ v8r10-rc1 for 4.11.0: data structures and common functions prototypes. + * BFQ v8r10 for 4.10.0: data structures and common functions prototypes. * * Based on ideas and code from CFQ: * Copyright (C) 2003 Jens Axboe