[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221101093417.10540-18-shikemeng@huawei.com>
Date: Tue, 1 Nov 2022 17:34:14 +0800
From: Kemeng Shi <shikemeng@...wei.com>
To: <paolo.valente@...aro.org>, <axboe@...nel.dk>
CC: <linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<shikemeng@...wei.com>
Subject: [PATCH 17/20] block, bfq: remove unnecessary traverse in bfq_add_to_burst
Do mark burst and remove from list in a single traverse to remove
unnecessary re-traverse.
Signed-off-by: Kemeng Shi <shikemeng@...wei.com>
---
block/bfq-iosched.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 1402dfd9f448..0864254b8dcd 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -1255,7 +1255,7 @@ static void bfq_add_to_burst(struct bfq_data *bfqd, struct bfq_queue *bfqq)
bfqd->burst_size++;
if (bfqd->burst_size == bfqd->bfq_large_burst_thresh) {
- struct bfq_queue *pos, *bfqq_item;
+ struct bfq_queue *pos;
struct hlist_node *n;
/*
@@ -1267,13 +1267,6 @@ static void bfq_add_to_burst(struct bfq_data *bfqd, struct bfq_queue *bfqq)
/*
* We can now mark all queues in the burst list as
* belonging to a large burst.
- */
- hlist_for_each_entry(bfqq_item, &bfqd->burst_list,
- burst_list_node)
- bfq_mark_bfqq_in_large_burst(bfqq_item);
- bfq_mark_bfqq_in_large_burst(bfqq);
-
- /*
* From now on, and until the current burst finishes, any
* new queue being activated shortly after the last queue
* was inserted in the burst can be immediately marked as
@@ -1281,8 +1274,11 @@ static void bfq_add_to_burst(struct bfq_data *bfqd, struct bfq_queue *bfqq)
* needed any more. Remove it.
*/
hlist_for_each_entry_safe(pos, n, &bfqd->burst_list,
- burst_list_node)
+ burst_list_node) {
+ bfq_mark_bfqq_in_large_burst(pos);
hlist_del_init(&pos->burst_list_node);
+ }
+ bfq_mark_bfqq_in_large_burst(bfqq);
} else /*
* Burst not yet large: add bfqq to the burst list. Do
* not increment the ref counter for bfqq, because bfqq
--
2.30.0
Powered by blists - more mailing lists