Skip to content

Commit 871cdea

Browse files
tititiou36kuba-moo
authored andcommitted
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/[email protected]/ Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/561bb4974499a328ac39aff31858465d9bd12b1c.1722752370.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 63a796b commit 871cdea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/tcp_htcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static inline void htcp_alpha_update(struct htcp *ca)
185185
u32 scale = (HZ << 3) / (10 * minRTT);
186186

187187
/* clamping ratio to interval [0.5,10]<<3 */
188-
scale = min(max(scale, 1U << 2), 10U << 3);
188+
scale = clamp(scale, 1U << 2, 10U << 3);
189189
factor = (factor << 3) / scale;
190190
if (!factor)
191191
factor = 1;

0 commit comments

Comments
 (0)