]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: fix mem under-charging with zerocopy sendmsg()
authorEric Dumazet <edumazet@google.com>
Tue, 1 Feb 2022 06:52:54 +0000 (22:52 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 2 Feb 2022 04:21:40 +0000 (20:21 -0800)
commit5947b7d67bd7e102c12f37cf7f858de01760b62d
tree524d5d9fedeea8d2594e0b7bdb9f524da541143a
parentcd9203fff822769478c5a2d5d55c733b013e3527
tcp: fix mem under-charging with zerocopy sendmsg()

We got reports of following warning in inet_sock_destruct()

WARN_ON(sk_forward_alloc_get(sk));

Whenever we add a non zero-copy fragment to a pure zerocopy skb,
we have to anticipate that whole skb->truesize will be uncharged
when skb is finally freed.

skb->data_len is the payload length. But the memory truesize
estimated by __zerocopy_sg_from_iter() is page aligned.

Fixes: 402623a4cc78 ("net: avoid double accounting for pure zerocopy skbs")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Talal Ahmad <talalahmad@google.com>
Cc: Arjun Roy <arjunroy@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Link: https://lore.kernel.org/r/20220201065254.680532-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp.c