* [PATCH net-next] tcp: Use clamp() in htcp_alpha_update()
@ 2024-07-27 12:30 Christophe JAILLET
2024-07-27 16:17 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2024-07-27 12:30 UTC (permalink / raw)
To: David.Laight, Eric Dumazet, David S. Miller, David Ahern,
Jakub Kicinski, Paolo Abeni
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev
Using clamp instead of min(max()) is easier to read and it matches even
better the comment just above it.
It also reduces the size of the preprocessed files by ~ 36 ko.
(see [1] for a discussion about it)
$ ls -l net/ipv4/tcp_htcp*.i
5871593 27 juil. 10:19 net/ipv4/tcp_htcp.old.i
5835319 27 juil. 10:21 net/ipv4/tcp_htcp.new.i
[1]: https://lore.kernel.org/all/23bdb6fc8d884ceebeb6e8b8653b8cfe@AcuMS.aculab.com/
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
net/ipv4/tcp_htcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c
index 52b1f2665dfa..81b96331b2bb 100644
--- a/net/ipv4/tcp_htcp.c
+++ b/net/ipv4/tcp_htcp.c
@@ -185,7 +185,7 @@ static inline void htcp_alpha_update(struct htcp *ca)
u32 scale = (HZ << 3) / (10 * minRTT);
/* clamping ratio to interval [0.5,10]<<3 */
- scale = min(max(scale, 1U << 2), 10U << 3);
+ scale = clamp(scale, 1U << 2, 10U << 3);
factor = (factor << 3) / scale;
if (!factor)
factor = 1;
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] tcp: Use clamp() in htcp_alpha_update()
2024-07-27 12:30 [PATCH net-next] tcp: Use clamp() in htcp_alpha_update() Christophe JAILLET
@ 2024-07-27 16:17 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2024-07-27 16:17 UTC (permalink / raw)
To: Christophe JAILLET
Cc: David.Laight, Eric Dumazet, David S. Miller, David Ahern,
Jakub Kicinski, Paolo Abeni, linux-kernel, kernel-janitors,
netdev
On Sat, Jul 27, 2024 at 02:30:45PM +0200, Christophe JAILLET wrote:
> Using clamp instead of min(max()) is easier to read and it matches even
> better the comment just above it.
>
> It also reduces the size of the preprocessed files by ~ 36 ko.
> (see [1] for a discussion about it)
>
> $ ls -l net/ipv4/tcp_htcp*.i
> 5871593 27 juil. 10:19 net/ipv4/tcp_htcp.old.i
> 5835319 27 juil. 10:21 net/ipv4/tcp_htcp.new.i
>
> [1]: https://lore.kernel.org/all/23bdb6fc8d884ceebeb6e8b8653b8cfe@AcuMS.aculab.com/
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
## Form letter - net-next-closed
(Adapted from text by Jakub)
The merge window for v6.11 has begun and therefore net-next is closed
for new drivers, features, code refactoring and optimizations.
We are currently accepting bug fixes only.
Please repost when net-next reopens after 28th July.
RFC patches sent for review only are welcome at any time.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
--
pw-bot: defer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-27 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-27 12:30 [PATCH net-next] tcp: Use clamp() in htcp_alpha_update() Christophe JAILLET
2024-07-27 16:17 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).