From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 599A83B29D for ; Fri, 6 Sep 2024 21:14:17 -0400 (EDT) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A3F32A43B4A; Sat, 7 Sep 2024 01:14:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46BCAC4CEC4; Sat, 7 Sep 2024 01:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725671656; bh=wf51T13dH53Kyjr9k6X4rECRSev9KzFZmG/yaTpBkVo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DkHLATM+cQka/l4F4KRRYxp7D456XNqh0W+W6SFpZU/mIByFNDGDwiV4JigTEY14P Yux8T0xXHh3TtYfNqNsdeXKp3JlAysw4ypCnJgvcrHwN7+6gQIYrbYoSqK6rjXwKMM XY3KXwxZ8eDdV0i7T5n1GCVPyU28Id6ARxh66KZaqHx1y+9Qv/mYA9wV6YFjn3UJ8T M+q2Nmmqqumhz+9IB2MbYatQczwi9yV/aGKVSlcUFX7Op0HBnsK2/f53JJp811cGJL a6Ufdnfsvxwcsc4k/HrAFVSI4FqTIx6RXZEaazusyO1epdMyC1ANXyqp1MYrBiSXoK 8HnDqJU81Xj1A== Date: Fri, 6 Sep 2024 18:14:15 -0700 From: Jakub Kicinski To: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Cc: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Dave Taht , "David S. Miller" , Eric Dumazet , Paolo Abeni , cake@lists.bufferbloat.net, netdev@vger.kernel.org Message-ID: <20240906181415.11d34150@kernel.org> In-Reply-To: <20240904100516.16926-1-toke@redhat.com> References: <20240904100516.16926-1-toke@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Cake] [PATCH net-next] sch_cake: constify inverse square root cache X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2024 01:14:17 -0000 On Wed, 4 Sep 2024 12:05:16 +0200 Toke H=C3=B8iland-J=C3=B8rgensen wrote: > +/* There is a big difference in timing between the accurate values place= d 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. H= ence, > + * these values are calculated using eight Newton steps, using the imple= mentation > + * below. Above 16, a single Newton step gives sufficient accuracy in ei= ther > + * 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] =3D {0}; > +static const u32 inv_sqrt_cache[REC_INV_SQRT_CACHE] =3D { > + ~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 --=20 pw-bot: cr