From ee73f1740f689cafde3cde13d711eecbac985090 Mon Sep 17 00:00:00 2001 From: Kusuma Vasana Date: Thu, 13 Aug 2026 15:39:36 +0530 Subject: [PATCH] Fix high CPU usage on UDP GRO receive path The UDP GRO receive path used recvmsg() with MSG_DONTWAIT, causing the receiver thread to busy-poll and waste CPU without throughput benefit. Make the GRO receive path blocking instead. Blocking is safe because the server receives in a worker thread with deferred cancellation, while --rcv-timeout is enforced by the main progress loop. On timeout, cleanup_server() cancels and joins the worker; because recvmsg() is a cancellation point, a blocked receive is interrupted and the server exits cleanly. Signed-off-by: Kusuma Vasana --- src/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net.c b/src/net.c index a8c327908..4a6baf431 100644 --- a/src/net.c +++ b/src/net.c @@ -577,7 +577,7 @@ static int recv_msg_gro(int fd, char *buf, int len, int *gso_size) msg.msg_controllen = sizeof(control); *gso_size = -1; - ret = recvmsg(fd, &msg, MSG_DONTWAIT); + ret = recvmsg(fd, &msg, 0); if (ret > 0) { for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {