diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-06-23 14:44:38 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-24 11:17:21 -0700 |
commit | 6d123b81ac615072a8525c13c6c41b695270a15d (patch) | |
tree | a3762d3a32ed38c29c3509d6dc84d85bfc3edc69 /net/ipv6/seg6_hmac.c | |
parent | ae24bab257bb2043b53c80e65cdd8b507ace06c4 (diff) |
net: ip: avoid OOM kills with large UDP sends over loopback
Dave observed number of machines hitting OOM on the UDP send
path. The workload seems to be sending large UDP packets over
loopback. Since loopback has MTU of 64k kernel will try to
allocate an skb with up to 64k of head space. This has a good
chance of failing under memory pressure. What's worse if
the message length is <32k the allocation may trigger an
OOM killer.
This is entirely avoidable, we can use an skb with page frags.
af_unix solves a similar problem by limiting the head
length to SKB_MAX_ALLOC. This seems like a good and simple
approach. It means that UDP messages > 16kB will now
use fragments if underlying device supports SG, if extra
allocator pressure causes regressions in real workloads
we can switch to trying the large allocation first and
falling back.
v4: pre-calculate all the additions to alloclen so
we can be sure it won't go over order-2
Reported-by: Dave Jones <dsj@fb.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/seg6_hmac.c')
0 files changed, 0 insertions, 0 deletions