[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKYAXd9S4PPG_7Ea82=d5sRjNw5iPgv2MDNWBO7QnzP27poxnw@mail.gmail.com>
Date: Tue, 18 Nov 2025 09:39:13 +0900
From: Namjae Jeon <linkinjeon@...nel.org>
To: Stefan Metzmacher <metze@...ba.org>, Qingfang Deng <dqfext@...il.com>
Cc: Steve French <smfrench@...il.com>, Sergey Senozhatsky <senozhatsky@...omium.org>,
Tom Talpey <tom@...pey.com>, Ronnie Sahlberg <lsahlber@...hat.com>, Hyunchul Lee <hyc.lee@...il.com>,
linux-cifs@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Simon Horman <horms@...nel.org>
Subject: Re: [PATCH v3] ksmbd: server: avoid busy polling in accept loop
On Mon, Nov 17, 2025 at 11:52 PM Stefan Metzmacher <metze@...ba.org> wrote:
>
> 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@...il.com>
>
> Reviewed-by: Stefan Metzmacher <metze@...ba.org>
Applied it to #ksmbd-for-next-next.
Thanks!
Powered by blists - more mailing lists