mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
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 <yukuai3@huawei.com> Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20221110112622.389332-1-Yuwei.Guan@zeekrlife.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -7063,7 +7063,9 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
|
|||||||
bfqd->idle_slice_timer.function = bfq_idle_slice_timer;
|
bfqd->idle_slice_timer.function = bfq_idle_slice_timer;
|
||||||
|
|
||||||
bfqd->queue_weights_tree = RB_ROOT_CACHED;
|
bfqd->queue_weights_tree = RB_ROOT_CACHED;
|
||||||
|
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
||||||
bfqd->num_groups_with_pending_reqs = 0;
|
bfqd->num_groups_with_pending_reqs = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
INIT_LIST_HEAD(&bfqd->active_list);
|
INIT_LIST_HEAD(&bfqd->active_list);
|
||||||
INIT_LIST_HEAD(&bfqd->idle_list);
|
INIT_LIST_HEAD(&bfqd->idle_list);
|
||||||
|
|||||||
@@ -197,8 +197,10 @@ struct bfq_entity {
|
|||||||
/* flag, set to request a weight, ioprio or ioprio_class change */
|
/* flag, set to request a weight, ioprio or ioprio_class change */
|
||||||
int prio_changed;
|
int prio_changed;
|
||||||
|
|
||||||
|
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
||||||
/* flag, set if the entity is counted in groups_with_pending_reqs */
|
/* flag, set if the entity is counted in groups_with_pending_reqs */
|
||||||
bool in_groups_with_pending_reqs;
|
bool in_groups_with_pending_reqs;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* last child queue of entity created (for non-leaf entities) */
|
/* last child queue of entity created (for non-leaf entities) */
|
||||||
struct bfq_queue *last_bfqq_created;
|
struct bfq_queue *last_bfqq_created;
|
||||||
@@ -491,6 +493,7 @@ struct bfq_data {
|
|||||||
*/
|
*/
|
||||||
struct rb_root_cached queue_weights_tree;
|
struct rb_root_cached queue_weights_tree;
|
||||||
|
|
||||||
|
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
||||||
/*
|
/*
|
||||||
* Number of groups with at least one process that
|
* Number of groups with at least one process that
|
||||||
* has at least one request waiting for completion. Note that
|
* has at least one request waiting for completion. Note that
|
||||||
@@ -538,6 +541,7 @@ struct bfq_data {
|
|||||||
* with no request waiting for completion.
|
* with no request waiting for completion.
|
||||||
*/
|
*/
|
||||||
unsigned int num_groups_with_pending_reqs;
|
unsigned int num_groups_with_pending_reqs;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Per-class (RT, BE, IDLE) number of bfq_queues containing
|
* Per-class (RT, BE, IDLE) number of bfq_queues containing
|
||||||
|
|||||||
@@ -1612,28 +1612,28 @@ void bfq_requeue_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
|
|||||||
|
|
||||||
void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
|
void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
||||||
struct bfq_entity *entity = &bfqq->entity;
|
struct bfq_entity *entity = &bfqq->entity;
|
||||||
|
|
||||||
if (!entity->in_groups_with_pending_reqs) {
|
if (!entity->in_groups_with_pending_reqs) {
|
||||||
entity->in_groups_with_pending_reqs = true;
|
entity->in_groups_with_pending_reqs = true;
|
||||||
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
|
||||||
if (!(bfqq_group(bfqq)->num_queues_with_pending_reqs++))
|
if (!(bfqq_group(bfqq)->num_queues_with_pending_reqs++))
|
||||||
bfqq->bfqd->num_groups_with_pending_reqs++;
|
bfqq->bfqd->num_groups_with_pending_reqs++;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
|
void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
||||||
struct bfq_entity *entity = &bfqq->entity;
|
struct bfq_entity *entity = &bfqq->entity;
|
||||||
|
|
||||||
if (entity->in_groups_with_pending_reqs) {
|
if (entity->in_groups_with_pending_reqs) {
|
||||||
entity->in_groups_with_pending_reqs = false;
|
entity->in_groups_with_pending_reqs = false;
|
||||||
#ifdef CONFIG_BFQ_GROUP_IOSCHED
|
|
||||||
if (!(--bfqq_group(bfqq)->num_queues_with_pending_reqs))
|
if (!(--bfqq_group(bfqq)->num_queues_with_pending_reqs))
|
||||||
bfqq->bfqd->num_groups_with_pending_reqs--;
|
bfqq->bfqd->num_groups_with_pending_reqs--;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user