diff options
| author | Qingfang Deng <dqfext@gmail.com> | 2025-11-17 16:59:00 +0800 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2025-11-30 21:11:45 -0600 |
| commit | 3316a8fc840d82fad5efcf76ad0ea3f76fdca209 (patch) | |
| tree | fdba40238c9cfd570f3579ea272291dd854f3e68 /tools/lib/python | |
| parent | 5003ad718af7705d6a519445a897843fac88167a (diff) | |
ksmbd: server: avoid busy polling in accept loop
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. During teardown, call shutdown() on the listening socket so that
accept() returns -EINVAL and the thread exits cleanly.
The socket release mutex is redundant because kthread_stop() blocks until
the listener thread returns, guaranteeing safe teardown ordering.
Also remove sk_rcvtimeo and sk_sndtimeo assignments, which only caused
accept() to return -EAGAIN prematurely.
Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
