Re: [PATCH] ksmbd: server: avoid busy polling in accept loop
From: Namjae Jeon
Date: Thu Oct 30 2025 - 04:11:53 EST
On Thu, Oct 30, 2025 at 3:47 PM Qingfang Deng <dqfext@xxxxxxxxx> wrote:
>
> 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.
>
> Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers")
> Signed-off-by: Qingfang Deng <dqfext@xxxxxxxxx>
Applied it to #ksmbd-for-next-next.
Thanks!