projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
63a796b
)
tcp: Use clamp() in htcp_alpha_update()
author
Christophe JAILLET
<christophe.jaillet@wanadoo.fr>
Sun, 4 Aug 2024 06:20:17 +0000
(08:20 +0200)
committer
Jakub Kicinski
<kuba@kernel.org>
Tue, 6 Aug 2024 19:16:25 +0000
(12:16 -0700)
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 ~ 2.5 ko.
(see [1] for a discussion about it)
$ ls -l net/ipv4/tcp_htcp*.i
5576024
27 juil. 10:19 net/ipv4/tcp_htcp.old.i
5573550
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>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link:
https://patch.msgid.link/561bb4974499a328ac39aff31858465d9bd12b1c.1722752370.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_htcp.c
patch
|
blob
|
history
diff --git
a/net/ipv4/tcp_htcp.c
b/net/ipv4/tcp_htcp.c
index
52b1f26
..
81b9633
100644
(file)
--- 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;