mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:02:20 +00:00
tcp: Use clamp() in htcp_alpha_update()
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>
This commit is contained in:
parent
63a796b498
commit
871cdea0f8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user