Skip to content

Commit 42c306e

Browse files
YuKuai-huaweiaxboe
authored andcommitted
block, bfq: don't break merge chain in bfq_split_bfqq()
Consider the following scenario: Process 1 Process 2 Process 3 Process 4 (BIC1) (BIC2) (BIC3) (BIC4) Λ | | | \-------------\ \-------------\ \--------------\| V V V bfqq1--------->bfqq2---------->bfqq3----------->bfqq4 ref 0 1 2 4 If Process 1 issue a new IO and bfqq2 is found, and then bfq_init_rq() decide to spilt bfqq2 by bfq_split_bfqq(). Howerver, procress reference of bfqq2 is 1 and bfq_split_bfqq() just clear the coop flag, which will break the merge chain. Expected result: caller will allocate a new bfqq for BIC1 Process 1 Process 2 Process 3 Process 4 (BIC1) (BIC2) (BIC3) (BIC4) | | | \-------------\ \--------------\| V V bfqq1--------->bfqq2---------->bfqq3----------->bfqq4 ref 0 0 1 3 Since the condition is only used for the last bfqq4 when the previous bfqq2 and bfqq3 are already splited. Fix the problem by checking if bfqq is the last one in the merge chain as well. Fixes: 36eca89 ("block, bfq: add Early Queue Merge (EQM)") Signed-off-by: Yu Kuai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 0e456db commit 42c306e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/bfq-iosched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6727,7 +6727,7 @@ bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq)
67276727
{
67286728
bfq_log_bfqq(bfqq->bfqd, bfqq, "splitting queue");
67296729

6730-
if (bfqq_process_refs(bfqq) == 1) {
6730+
if (bfqq_process_refs(bfqq) == 1 && !bfqq->new_bfqq) {
67316731
bfqq->pid = current->pid;
67326732
bfq_clear_bfqq_coop(bfqq);
67336733
bfq_clear_bfqq_split_coop(bfqq);

0 commit comments

Comments
 (0)