[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220427125251.yl7ff4ti33w6ktrf@quack3.lan>
Date: Wed, 27 Apr 2022 14:52:51 +0200
From: Jan Kara <jack@...e.cz>
To: Yu Kuai <yukuai3@...wei.com>
Cc: jack@...e.cz, tj@...nel.org, axboe@...nel.dk,
paolo.valente@...aro.org, cgroups@...r.kernel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
yi.zhang@...wei.com
Subject: Re: [PATCH -next v3 1/3] block, bfq: record how many queues are busy
in bfq_group
On Wed 27-04-22 20:47:20, Yu Kuai wrote:
> Prepare to refactor the counting of 'num_groups_with_pending_reqs'.
>
> Add a counter 'busy_queues' in bfq_group, and update it in
> bfq_add/del_bfqq_busy().
>
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
...
> diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
> index f8eb340381cf..53826797430f 100644
> --- a/block/bfq-wf2q.c
> +++ b/block/bfq-wf2q.c
> @@ -218,6 +218,14 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity)
> return false;
> }
>
> +static void bfq_update_busy_queues(struct bfq_queue *bfqq, bool is_add)
> +{
> + if (is_add)
> + bfqq_group(bfqq)->busy_queues++;
> + else
> + bfqq_group(bfqq)->busy_queues--;
> +}
> +
> #else /* CONFIG_BFQ_GROUP_IOSCHED */
I think the bool argument here unnecessarily hurts readability (it's
difficult to see what the argument means without looking into the
implementation). I'd rather create two functions bfq_{inc,dec}_busy_queues()
or if you really insist on a single function, we can have
bfq_add_busy_queues() and have 'int' argument that will be +1 or -1.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists