]> www.infradead.org Git - users/dwmw2/linux.git/commit
selftests: fix OOM in msg_zerocopy selftest
authorZijian Zhang <zijianzhang@bytedance.com>
Mon, 1 Jul 2024 22:53:48 +0000 (22:53 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Jul 2024 02:42:32 +0000 (19:42 -0700)
commitaf2b7e5b741aaae9ffbba2c660def434e07aa241
treee53ad2a73bafc2ee51f616338895f66c450e571a
parentf66738dccd235112888c5b078eaef80fc9c68cf8
selftests: fix OOM in msg_zerocopy selftest

In selftests/net/msg_zerocopy.c, it has a while loop keeps calling sendmsg
on a socket with MSG_ZEROCOPY flag, and it will recv the notifications
until the socket is not writable. Typically, it will start the receiving
process after around 30+ sendmsgs. However, as the introduction of commit
dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale"), the sender is
always writable and does not get any chance to run recv notifications.
The selftest always exits with OUT_OF_MEMORY because the memory used by
opt_skb exceeds the net.core.optmem_max. Meanwhile, it could be set to a
different value to trigger OOM on older kernels too.

Thus, we introduce "cfg_notification_limit" to force sender to receive
notifications after some number of sendmsgs.

Fixes: 07b65c5b31ce ("test: add msg_zerocopy test")
Signed-off-by: Zijian Zhang <zijianzhang@bytedance.com>
Signed-off-by: Xiaochun Lu <xiaochun.lu@bytedance.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20240701225349.3395580-2-zijianzhang@bytedance.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/msg_zerocopy.c