diff mbox series

[RESEND,v2,10/10] block, bfq: remove check of bfq_wr_max_softrt_rate which is always greater than 0

Message ID 20221222191641.1643117-11-shikemeng@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series A few bugfix and cleancode patch for bfq | expand

Commit Message

Kemeng Shi Dec. 22, 2022, 7:16 p.m. UTC
bfqd->bfq_wr_max_softrt_rate is assigned with 7000 in bfq_init_queue and
never changed. So we can remove bfqd->bfq_wr_max_softrt_rate > 0 check
which is always true.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 block/bfq-iosched.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Jan Kara Jan. 2, 2023, 4:05 p.m. UTC | #1
On Fri 23-12-22 03:16:41, Kemeng Shi wrote:
> bfqd->bfq_wr_max_softrt_rate is assigned with 7000 in bfq_init_queue and
> never changed. So we can remove bfqd->bfq_wr_max_softrt_rate > 0 check
> which is always true.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

I would just leave these checks for documentation purposes and for possible
experiments (e.g. disabling this logic by setting bfq_wr_max_softrt_rate to
0). Alternatively, we could just define a constant for this and
then we can remove all the checks, that would be a clean solution as well.

								Honza

> ---
>  block/bfq-iosched.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
> index 91bc68fba72d..00cdd42ac02a 100644
> --- a/block/bfq-iosched.c
> +++ b/block/bfq-iosched.c
> @@ -1788,8 +1788,7 @@ static void bfq_bfqq_handle_idle_busy_switch(struct bfq_data *bfqd,
>  	 *   to control its weight explicitly)
>  	 */
>  	in_burst = bfq_bfqq_in_large_burst(bfqq);
> -	soft_rt = bfqd->bfq_wr_max_softrt_rate > 0 &&
> -		!BFQQ_TOTALLY_SEEKY(bfqq) &&
> +	soft_rt = !BFQQ_TOTALLY_SEEKY(bfqq) &&
>  		!in_burst &&
>  		time_is_before_jiffies(bfqq->soft_rt_next_start) &&
>  		bfqq->dispatched == 0 &&
> @@ -4284,8 +4283,7 @@ void bfq_bfqq_expire(struct bfq_data *bfqd,
>  	if (bfqd->low_latency && bfqq->wr_coeff == 1)
>  		bfqq->last_wr_start_finish = jiffies;
>  
> -	if (bfqd->low_latency && bfqd->bfq_wr_max_softrt_rate > 0 &&
> -	    RB_EMPTY_ROOT(&bfqq->sort_list)) {
> +	if (bfqd->low_latency && RB_EMPTY_ROOT(&bfqq->sort_list)) {
>  		/*
>  		 * If we get here, and there are no outstanding
>  		 * requests, then the request pattern is isochronous
> -- 
> 2.30.0
>
diff mbox series

Patch

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 91bc68fba72d..00cdd42ac02a 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -1788,8 +1788,7 @@  static void bfq_bfqq_handle_idle_busy_switch(struct bfq_data *bfqd,
 	 *   to control its weight explicitly)
 	 */
 	in_burst = bfq_bfqq_in_large_burst(bfqq);
-	soft_rt = bfqd->bfq_wr_max_softrt_rate > 0 &&
-		!BFQQ_TOTALLY_SEEKY(bfqq) &&
+	soft_rt = !BFQQ_TOTALLY_SEEKY(bfqq) &&
 		!in_burst &&
 		time_is_before_jiffies(bfqq->soft_rt_next_start) &&
 		bfqq->dispatched == 0 &&
@@ -4284,8 +4283,7 @@  void bfq_bfqq_expire(struct bfq_data *bfqd,
 	if (bfqd->low_latency && bfqq->wr_coeff == 1)
 		bfqq->last_wr_start_finish = jiffies;
 
-	if (bfqd->low_latency && bfqd->bfq_wr_max_softrt_rate > 0 &&
-	    RB_EMPTY_ROOT(&bfqq->sort_list)) {
+	if (bfqd->low_latency && RB_EMPTY_ROOT(&bfqq->sort_list)) {
 		/*
 		 * If we get here, and there are no outstanding
 		 * requests, then the request pattern is isochronous