[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260106-nfsd-dynathread-v2-0-416e5f27b2b6@kernel.org>
Date: Tue, 06 Jan 2026 13:59:42 -0500
From: Jeff Layton <jlayton@...nel.org>
To: Chuck Lever <chuck.lever@...cle.com>, NeilBrown <neil@...wn.name>,
Olga Kornievskaia <okorniev@...hat.com>, Dai Ngo <Dai.Ngo@...cle.com>,
Tom Talpey <tom@...pey.com>, Trond Myklebust <trondmy@...nel.org>,
Anna Schumaker <anna@...nel.org>
Cc: linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
Jeff Layton <jlayton@...nel.org>
Subject: [PATCH v2 0/8] nfsd, sunrpc: allow for a dynamically-sized
threadpool
This version of the patchset fixes a number of warts in the first, and
hopefully gets this closer to something mergeable.
This patchset allows nfsd to dynamically size its threadpool as needed.
The main user-visible change is the addition of new controls that allow
the admin to set a minimum number of threads.
When the minimum is set to a non-zero value, the traditional "threads"
setting is interpreted as a maximum number of threads instead of a
static count. The server will start the minimum number of threads, and
then ramp up the thread count as needed. When the server is idle, it
will gradually ramp down the thread count.
This control scheme should allow us to sanely switch between kernels
that do and do not support dynamic threading. In the case where dynamic
threading is not supported, the user will just get the static maximum
number of threads, just like they do today.
So far this is only lightly tested, but it seems to work well. I
still need to do some benchmarking to see whether this affects
performance, so I'm posting this as an RFC for now.
Does this approach look sane to everyone?
Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
Changes in v2:
- svc_recv() now takes a timeout parameter. This should mean that
non-dynamic RPC services are unaffected by these changes.
- if min_threads is larger than the max, then clamp it to the max
- simplify SP_TASK_STARTING usage. Have same task set and clear it.
- rework thread starting logic (EBUSY handling)
- reorder arguments to svc_set_num_threads() and svc_set_pool_threads()
- break up larger patches
- Link to v1: https://lore.kernel.org/r/20251213-nfsd-dynathread-v1-0-de755e59cbc4@kernel.org
---
Jeff Layton (8):
sunrpc: split svc_set_num_threads() into two functions
sunrpc: remove special handling of NULL pool from svc_start/stop_kthreads()
sunrpc: track the max number of requested threads in a pool
sunrpc: introduce the concept of a minimum number of threads per pool
sunrpc: split new thread creation into a separate function
sunrpc: allow svc_recv() to return -ETIMEDOUT and -EBUSY
nfsd: adjust number of running nfsd threads based on activity
nfsd: add controls to set the minimum number of threads per pool
Documentation/netlink/specs/nfsd.yaml | 5 +
fs/lockd/svc.c | 6 +-
fs/nfs/callback.c | 10 +-
fs/nfsd/netlink.c | 5 +-
fs/nfsd/netns.h | 6 +
fs/nfsd/nfsctl.c | 50 ++++++++
fs/nfsd/nfssvc.c | 63 +++++++---
fs/nfsd/trace.h | 54 +++++++++
include/linux/sunrpc/svc.h | 13 ++-
include/linux/sunrpc/svcsock.h | 2 +-
include/uapi/linux/nfsd_netlink.h | 1 +
net/sunrpc/svc.c | 210 ++++++++++++++++++++--------------
net/sunrpc/svc_xprt.c | 44 +++++--
13 files changed, 349 insertions(+), 120 deletions(-)
---
base-commit: 83f633515af9382e7201e205112e18b995a80f70
change-id: 20251212-nfsd-dynathread-9f7a31172005
Best regards,
--
Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists