On 04/04/2018 05:30 AM, Paolo Abeni wrote:
> After commit 694aba690de0 ("ipv4: factorize sk_wmem_alloc updates
> done by __ip_append_data()") and commit 1f4c6eb24029 ("ipv6:
> factorize sk_wmem_alloc updates done by __ip6_append_data()"),
> when transmitting sub MTU datagram, an addtional, unneeded atomic
> operation is performed in ip*_append_data() to update wmem_alloc:
> in the above condition the delta is 0.
>
> The above cause small but measurable performance regression in UDP
> xmit tput test with packet size below MTU.
>
> This change avoids such overhead updating wmem_alloc only if
> wmem_alloc_delta is non zero.
>
> The error path is left intentionally unmodified: it's a slow path
> and simplicity is preferred to performances.
>
> Fixes: 694aba690de0 ("ipv4: factorize sk_wmem_alloc updates done by
> __ip_append_data()")
> Fixes: 1f4c6eb24029 ("ipv6: factorize sk_wmem_alloc updates done by
> __ip6_append_data()")
> Signed-off-by: Paolo Abeni <[email protected]>
> ---
SGTM, thanks Paolo
Reviewed-by: Eric Dumazet <[email protected]>
My intent was to modify sock_alloc_send_pskb() to accept to opt-out
the skb_set_owner_w() call, but I forgot that the merge window was starting
last week-end.
So if a UDP datagram needs 2 skb, only one sk_wmem_alloc change would happen,
not 1 + 1.