Re: [PATCH] ksmbd: server: avoid busy polling in accept loop

From: Stefan Metzmacher

Date: Tue Nov 11 2025 - 02:12:48 EST


Am 30.10.25 um 07:47 schrieb Qingfang Deng:
The ksmbd listener thread was using busy waiting on a listening socket by
calling kernel_accept() with SOCK_NONBLOCK and retrying every 100ms on
-EAGAIN. Since this thread is dedicated to accepting new connections,
there is no need for non-blocking mode.

Switch to a blocking accept() call instead, allowing the thread to sleep
until a new connection arrives. This avoids unnecessary wakeups and CPU
usage.

Also remove:
- TCP_NODELAY, which has no effect on a listening socket.
- sk_rcvtimeo and sk_sndtimeo assignments, which only caused accept()
to return -EAGAIN prematurely.

Aren't these inherited to the accepted sockets?
So we need to apply them to the accepted sockets now
instead of dropping them completely?

metze