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(-)
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@kernel.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@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
On Tue, 06 Jan 2026 13:59:42 -0500, Jeff Layton wrote:
> 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.
>
> [...]
Applied to nfsd-testing, thanks!
[1/8] sunrpc: split svc_set_num_threads() into two functions
commit: 039d0b7837eaad0d904631df3ec26b4961ee740a
[2/8] sunrpc: remove special handling of NULL pool from svc_start/stop_kthreads()
commit: 040f69a4bff8ba6236d69bca06c62adb7588268b
[3/8] sunrpc: track the max number of requested threads in a pool
commit: 2672a852bfc6d7597a8b202cf5ee813a4a04b1b8
[4/8] sunrpc: introduce the concept of a minimum number of threads per pool
commit: 80099415fa314dec028bbb3e904ed57ddea55d1c
[5/8] sunrpc: split new thread creation into a separate function
commit: ad23853b5e7bc156652fd957425d6891dd864ea1
[6/8] sunrpc: allow svc_recv() to return -ETIMEDOUT and -EBUSY
commit: a37178a2642f98fd6cbed39fa0c508dce3bd7bf8
[7/8] nfsd: adjust number of running nfsd threads based on activity
commit: f375bafd744fa40cdc48d252e5f5db1242100881
[8/8] nfsd: add controls to set the minimum number of threads per pool
commit: fe054be1747e1754bc81ea3dabbf85dfab2bed27
--
Chuck Lever
On Tue, Jan 6, 2026, at 1:59 PM, Jeff Layton wrote: > 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@kernel.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@kernel.org> I'm comfortable with this series. Let me know when you are ready for me to apply it. -- Chuck Lever
On Tue, 2026-01-06 at 16:26 -0500, Chuck Lever wrote: > > On Tue, Jan 6, 2026, at 1:59 PM, Jeff Layton wrote: > > 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@kernel.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@kernel.org> > > I'm comfortable with this series. Let me know when you are > ready for me to apply it. > I think it'd be great to put this in nfsd-testing soon so we can start playing with it. I'll plan to post the nfs-utils patches for this in the near future too (they need a bit more work). Thanks, -- Jeff Layton <jlayton@kernel.org>
© 2016 - 2026 Red Hat, Inc.