Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit e50c9a3

Browse files
YuKuai-huaweigregkh
authored andcommitted
block, bfq: choose the last bfqq from merge chain in bfq_setup_cooperator()
[ Upstream commit 0e456db ] Consider the following merge chain: Process 1 Process 2 Process 3 Process 4 (BIC1) (BIC2) (BIC3) (BIC4) Λ | | | \--------------\ \-------------\ \-------------\| V V V bfqq1--------->bfqq2---------->bfqq3----------->bfqq4 IO from Process 1 will get bfqf2 from BIC1 first, then bfq_setup_cooperator() will found bfqq2 already merged to bfqq3 and then handle this IO from bfqq3. However, the merge chain can be much deeper and bfqq3 can be merged to other bfqq as well. Fix this problem by iterating to the last bfqq in bfq_setup_cooperator(). Fixes: 36eca89 ("block, bfq: add Early Queue Merge (EQM)") Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20240902130329.3787024-3-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7faed28 commit e50c9a3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

block/bfq-iosched.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -2911,8 +2911,12 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq,
29112911
struct bfq_iocq_bfqq_data *bfqq_data = &bic->bfqq_data[a_idx];
29122912

29132913
/* if a merge has already been setup, then proceed with that first */
2914-
if (bfqq->new_bfqq)
2915-
return bfqq->new_bfqq;
2914+
new_bfqq = bfqq->new_bfqq;
2915+
if (new_bfqq) {
2916+
while (new_bfqq->new_bfqq)
2917+
new_bfqq = new_bfqq->new_bfqq;
2918+
return new_bfqq;
2919+
}
29162920

29172921
/*
29182922
* Check delayed stable merge for rotational or non-queueing

0 commit comments

Comments
 (0)