Skip to content

Commit 1eb2062

Browse files
Yuwei Guanaxboe
authored andcommitted
block, bfq: only do counting of pending-request for BFQ_GROUP_IOSCHED
The 'bfqd->num_groups_with_pending_reqs' is used when CONFIG_BFQ_GROUP_IOSCHED is enabled, so let the variables and processes take effect when CONFIG_BFQ_GROUP_IOSCHED is enabled. Cc: Yu Kuai <[email protected]> Signed-off-by: Yuwei Guan <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Yu Kuai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 813e693 commit 1eb2062

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

block/bfq-iosched.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7063,7 +7063,9 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
70637063
bfqd->idle_slice_timer.function = bfq_idle_slice_timer;
70647064

70657065
bfqd->queue_weights_tree = RB_ROOT_CACHED;
7066+
#ifdef CONFIG_BFQ_GROUP_IOSCHED
70667067
bfqd->num_groups_with_pending_reqs = 0;
7068+
#endif
70677069

70687070
INIT_LIST_HEAD(&bfqd->active_list);
70697071
INIT_LIST_HEAD(&bfqd->idle_list);

block/bfq-iosched.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ struct bfq_entity {
197197
/* flag, set to request a weight, ioprio or ioprio_class change */
198198
int prio_changed;
199199

200+
#ifdef CONFIG_BFQ_GROUP_IOSCHED
200201
/* flag, set if the entity is counted in groups_with_pending_reqs */
201202
bool in_groups_with_pending_reqs;
203+
#endif
202204

203205
/* last child queue of entity created (for non-leaf entities) */
204206
struct bfq_queue *last_bfqq_created;
@@ -491,6 +493,7 @@ struct bfq_data {
491493
*/
492494
struct rb_root_cached queue_weights_tree;
493495

496+
#ifdef CONFIG_BFQ_GROUP_IOSCHED
494497
/*
495498
* Number of groups with at least one process that
496499
* has at least one request waiting for completion. Note that
@@ -538,6 +541,7 @@ struct bfq_data {
538541
* with no request waiting for completion.
539542
*/
540543
unsigned int num_groups_with_pending_reqs;
544+
#endif
541545

542546
/*
543547
* Per-class (RT, BE, IDLE) number of bfq_queues containing

block/bfq-wf2q.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,28 +1612,28 @@ void bfq_requeue_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
16121612

16131613
void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
16141614
{
1615+
#ifdef CONFIG_BFQ_GROUP_IOSCHED
16151616
struct bfq_entity *entity = &bfqq->entity;
16161617

16171618
if (!entity->in_groups_with_pending_reqs) {
16181619
entity->in_groups_with_pending_reqs = true;
1619-
#ifdef CONFIG_BFQ_GROUP_IOSCHED
16201620
if (!(bfqq_group(bfqq)->num_queues_with_pending_reqs++))
16211621
bfqq->bfqd->num_groups_with_pending_reqs++;
1622-
#endif
16231622
}
1623+
#endif
16241624
}
16251625

16261626
void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
16271627
{
1628+
#ifdef CONFIG_BFQ_GROUP_IOSCHED
16281629
struct bfq_entity *entity = &bfqq->entity;
16291630

16301631
if (entity->in_groups_with_pending_reqs) {
16311632
entity->in_groups_with_pending_reqs = false;
1632-
#ifdef CONFIG_BFQ_GROUP_IOSCHED
16331633
if (!(--bfqq_group(bfqq)->num_queues_with_pending_reqs))
16341634
bfqq->bfqd->num_groups_with_pending_reqs--;
1635-
#endif
16361635
}
1636+
#endif
16371637
}
16381638

16391639
/*

0 commit comments

Comments
 (0)