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] [day] [month] [year] [list]
Message-ID: <20200511112340.GB1864@quack2.suse.cz>
Date:   Mon, 11 May 2020 13:23:40 +0200
From:   Jan Kara <jack@...e.cz>
To:     Tan Hu <tan.hu@....com.cn>
Cc:     akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
        jack@...e.cz, xue.zhihong@....com.cn, wang.yi59@....com.cn,
        wang.liang82@....com.cn
Subject: Re: [PATCH v2] lib/flex_proportions.c: cleanup __fprop_inc_percpu_max

On Sat 09-05-20 14:12:33, Tan Hu wrote:
> If the given type has fraction smaller than max_frac/FPROP_FRAC_BASE,
> the code could be modified to call __fprop_inc_percpu() directly and
> easier to understand. After this patch, fprop_reflect_period_percpu()
> will be called twice, and quicky return on pl->period == p->period
> test, so it would not result to significant downside of performance.
> 
> Thanks for Jan's guidance.
> 
> Signed-off-by: Tan Hu <tan.hu@....com.cn>

Thanks for the patch. It looks good to me. You can add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  lib/flex_proportions.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c
> index 7852bfff5..451543937 100644
> --- a/lib/flex_proportions.c
> +++ b/lib/flex_proportions.c
> @@ -266,8 +266,7 @@ void __fprop_inc_percpu_max(struct fprop_global *p,
>  		if (numerator >
>  		    (((u64)denominator) * max_frac) >> FPROP_FRAC_SHIFT)
>  			return;
> -	} else
> -		fprop_reflect_period_percpu(p, pl);
> -	percpu_counter_add_batch(&pl->events, 1, PROP_BATCH);
> -	percpu_counter_add(&p->events, 1);
> +	}
> +
> +	__fprop_inc_percpu(p, pl);
>  }
> -- 
> 2.19.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ