2022-11-01 10:23:27

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 00/20] A few bugfix and cleanup patches for bfq-iosched

This series contain a few patches to fix typo in comment, protect
max_budget from concurrent access and so on. More detail can be
found in the respective changelogs.

Kemeng Shi (20):
block, bfq: fix typo in comment
block, bfq: Update bfqd->max_budget with bfqd->lock held
block, bfq: correct bfq_max_budget and bfq_min_budget
block, bfq: simpfy computation of bfqd->budgets_assigned
block, bfq: recover the "service hole" if enough budget is left
block, bfq: correct interactive weight-raise check in
bfq_set_budget_timeout
block, bfq: simpfy check for interactive bfqq in bfq_update_wr_data
block, bfq: do srt filtering for interactive queues in
bfq_completed_request
block, bfq: remove redundant check if (bfqq->dispatched > 0)
block, bfq: define and use soft_rt, in_burst and wr_or_deserves_wr
only low_latency is enable
block, bfq: remove unnecessary "wr" part of wr_or_deserves_wr
block, bfq: start/restart service_from_wr accumulating correctly
block,bfq: remove redundant nonrot_with_queueing check in
bfq_setup_cooperator
block, bfq: remove redundant oom_bfqq check for bfqq from
bfq_find_close_cooperator
block, bfq: some cleanups for function bfq_pos_tree_add_move
block, bfq: remove unnecessary goto tag in __bfq_weights_tree_remove
block, bfq: remove unnecessary traverse in bfq_add_to_burst
block, bfq: remove unnecessary bfqq->next_rq = NULL in
bfq_remove_request
block, bfq: remove unnecessary local variable __bfqq in
bfq_setup_merge
block, bfq: remove unncessary process_ref check for merged queue in
bfq_setup_merge

block/bfq-iosched.c | 280 +++++++++++++++++++++-----------------------
1 file changed, 133 insertions(+), 147 deletions(-)

--
2.30.0



2022-11-01 10:25:23

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 20/20] block, bfq: remove unncessary process_ref check for merged queue in bfq_setup_merge

As we already check process_refs of original new_bfqq is not zero. The
later new_bfqq maybe the merged queue of original new_bfqq which inherit
the process_refs of original new_bfqq which is not zero, so process_refs
of merged queue will not be zero.
Remove unncessary check for merged queue and remove new_process_refs
which will not be used.

Signed-off-by: Kemeng Shi <[email protected]>
---
block/bfq-iosched.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 589ab59abcf5..0736577bfbfe 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -2740,7 +2740,7 @@ static struct bfq_queue *bfq_find_close_cooperator(struct bfq_data *bfqd,
static struct bfq_queue *
bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq)
{
- int process_refs, new_process_refs;
+ int process_refs;

/*
* If there are no process references on the new_bfqq, then it is
@@ -2758,12 +2758,11 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq)
}

process_refs = bfqq_process_refs(bfqq);
- new_process_refs = bfqq_process_refs(new_bfqq);
/*
* If the process for the bfqq has gone away, there is no
* sense in merging the queues.
*/
- if (process_refs == 0 || new_process_refs == 0)
+ if (process_refs == 0)
return NULL;

/*
--
2.30.0


2022-11-01 10:37:19

by Kemeng Shi

[permalink] [raw]
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 <[email protected]>
---
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