Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block, bfq: save & resume weight on a queue merge/split

bfq saves the state of a queue each time a merge occurs, to be
able to resume such a state when the queue is associated again
with its original process, on a split.

Unfortunately bfq does not save & restore also the weight of the
queue. If the weight is not correctly resumed when the queue is
recycled, then the weight of the recycled queue could differ
from the weight of the original queue.

This commit adds the missing save & resume of the weight.

Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Francesco Pollicino <fra.fra.800@gmail.com>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Francesco Pollicino and committed by
Jens Axboe
fffca087 1e66413c

+11
+2
block/bfq-iosched.c
··· 1028 1028 else 1029 1029 bfq_clear_bfqq_IO_bound(bfqq); 1030 1030 1031 + bfqq->entity.new_weight = bic->saved_weight; 1031 1032 bfqq->ttime = bic->saved_ttime; 1032 1033 bfqq->wr_coeff = bic->saved_wr_coeff; 1033 1034 bfqq->wr_start_at_switch_to_srt = bic->saved_wr_start_at_switch_to_srt; ··· 2503 2502 if (!bic) 2504 2503 return; 2505 2504 2505 + bic->saved_weight = bfqq->entity.orig_weight; 2506 2506 bic->saved_ttime = bfqq->ttime; 2507 2507 bic->saved_has_short_ttime = bfq_bfqq_has_short_ttime(bfqq); 2508 2508 bic->saved_IO_bound = bfq_bfqq_IO_bound(bfqq);
+9
block/bfq-iosched.h
··· 405 405 bool was_in_burst_list; 406 406 407 407 /* 408 + * Save the weight when a merge occurs, to be able 409 + * to restore it in case of split. If the weight is not 410 + * correctly resumed when the queue is recycled, 411 + * then the weight of the recycled queue could differ 412 + * from the weight of the original queue. 413 + */ 414 + unsigned int saved_weight; 415 + 416 + /* 408 417 * Similar to previous fields: save wr information. 409 418 */ 410 419 unsigned long saved_wr_coeff;