Re: [PATCH net-next] net/tcp: move TCP hash fail messages out of line

From: Dmitry Safonov
Date: Wed Apr 03 2024 - 13:01:44 EST


Hi Alexander,

On Wed, Apr 3, 2024 at 2:26 PM Alexander Lobakin
<aleksander.lobakin@xxxxxxxxx> wrote:
>
> tcp_hash_fail() is used multiple times on hotpath, including static
> inlines. It contains a couple branches and a lot of code, which all
> gets inlined into the call sites. For example, one call emits two
> calls to net_ratelimit() etc.
> Move as much as we can out of line to a new global function. Use enum
> to determine the type of failure. Check for net_ratelimit() only once,
> format common fields only once as well to pass only unique strings to
> pr_info().
> The result for vmlinux with Clang 19:
>
> add/remove: 2/0 grow/shrink: 0/4 up/down: 773/-4908 (-4135)
> Function old new delta
> __tcp_hash_fail - 757 +757
> __pfx___tcp_hash_fail - 16 +16
> tcp_inbound_ao_hash 1819 1062 -757
> tcp_ao_verify_hash 1217 451 -766
> tcp_inbound_md5_hash 1591 374 -1217
> tcp_inbound_hash 3566 1398 -2168

I can see that as an improvement, albeit that enum and the resulting switch
are quite gross, sorry.
I had patches to convert those messages to tracepoints (by Jakub's suggestion).
That seems to work quite nice and will remove this macro entirely:
https://lore.kernel.org/all/20240224-tcp-ao-tracepoints-v1-0-15f31b7f30a7@xxxxxxxxxx/

I need to send version 2 for that. Unfortunately, that got delayed by
me migrating
from my previous work laptop. That was not my choice, resulting in
little disruption.
I'm planning to send the new version optimistically by the end of this week,
at worst the next week.

Thanks,
Dmitry