lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y02p23KdUZfkYyzI@slm.duckdns.org>
Date:   Mon, 17 Oct 2022 09:15:39 -1000
From:   Tejun Heo <tj@...nel.org>
To:     Kemeng Shi <shikemeng@...wei.com>
Cc:     axboe@...nel.dk, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/8] blk-iocost: Avoid to call current_hweight_max if
 iocg->inuse == iocg->active

On Mon, Oct 17, 2022 at 10:00:09AM +0800, Kemeng Shi wrote:
> The old_hwi is already max hweight_inuse if iocg->inuse == iocg->active.
> Remove unnecessary calculation.
> 
> Signed-off-by: Kemeng Shi <shikemeng@...wei.com>
> ---
>  block/blk-iocost.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/block/blk-iocost.c b/block/blk-iocost.c
> index 96c1571a8a1d..fa90f471dfdc 100644
> --- a/block/blk-iocost.c
> +++ b/block/blk-iocost.c
> @@ -2299,7 +2299,10 @@ static void ioc_timer_fn(struct timer_list *timer)
>  			 * Determine the donation amount.
>  			 */
>  			current_hweight(iocg, &hwa, &old_hwi);
> -			hwm = current_hweight_max(iocg);
> +			if (iocg->inuse == iocg->active)
> +				hwm = old_hwi;
> +			else
> +				hwm = current_hweight_max(iocg);

I don't think this is correct. The intermediate nodes might be donating.
This also isn't a meaningful optimization given that it's in the cold
periodic timer path. I'd much rather keep the code simpler unless the
performance benfeit can be clearly demonstrated.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ