From: Stefan Metzmacher <metze@samba.org>
To: Qingfang Deng <dqfext@gmail.com>,
Namjae Jeon <linkinjeon@kernel.org>,
Steve French <smfrench@gmail.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Tom Talpey <tom@talpey.com>,
Ronnie Sahlberg <lsahlber@redhat.com>,
Hyunchul Lee <hyc.lee@gmail.com>,
linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org, Simon Horman <horms@kernel.org>
Subject: Re: [PATCH v3] ksmbd: server: avoid busy polling in accept loop
Date: Mon, 17 Nov 2025 15:52:24 +0100 [thread overview]
Message-ID: <cc80596c-f08d-465e-a503-bdb42fddbbae@samba.org> (raw)
In-Reply-To: <20251117085900.466432-1-dqfext@gmail.com>
Am 17.11.25 um 09:59 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. 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.
>
> Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers")
> Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
next prev parent reply other threads:[~2025-11-17 14:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 8:59 Qingfang Deng
2025-11-17 14:52 ` Stefan Metzmacher [this message]
2025-11-18 0:39 ` Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc80596c-f08d-465e-a503-bdb42fddbbae@samba.org \
--to=metze@samba.org \
--cc=dqfext@gmail.com \
--cc=horms@kernel.org \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lsahlber@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®