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: <20240906181415.11d34150@kernel.org>
Date: Fri, 6 Sep 2024 18:14:15 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Toke Høiland-Jørgensen <toke@...e.dk>, Jamal Hadi
 Salim <jhs@...atatu.com>, Cong Wang <xiyou.wangcong@...il.com>, Jiri Pirko
 <jiri@...nulli.us>, Dave Taht <dave.taht@...il.com>, "David S. Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
 <pabeni@...hat.com>, cake@...ts.bufferbloat.net, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] sch_cake: constify inverse square root cache

On Wed,  4 Sep 2024 12:05:16 +0200 Toke Høiland-Jørgensen wrote:
> +/* There is a big difference in timing between the accurate values placed in the
> + * cache and the approximations given by a single Newton step for small count
> + * values, particularly when stepping from count 1 to 2 or vice versa. Hence,
> + * these values are calculated using eight Newton steps, using the implementation
> + * below. Above 16, a single Newton step gives sufficient accuracy in either
> + * direction, given the precision stored.

Please line wrap the comments at 80 chars.

> + * The magnitude of the error when stepping up to count 2 is such as to give
> + * the value that *should* have been produced at count 4.
> + */
> +
>  #define REC_INV_SQRT_CACHE (16)
> -static u32 cobalt_rec_inv_sqrt_cache[REC_INV_SQRT_CACHE] = {0};
> +static const u32 inv_sqrt_cache[REC_INV_SQRT_CACHE] = {
> +	        ~0,         ~0, 3037000500, 2479700525,
> +	2147483647, 1920767767, 1753413056, 1623345051,
> +	1518500250, 1431655765, 1358187914, 1294981364,
> +	1239850263, 1191209601, 1147878294, 1108955788

checkpatch asks to use tabs to indent the ~0, which seems fair
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ