]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
nfsd: adjust number of running nfsd threads based on activity
authorJeff Layton <jlayton@kernel.org>
Tue, 6 Jan 2026 18:59:49 +0000 (13:59 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Wed, 28 Jan 2026 15:15:42 +0000 (10:15 -0500)
commit1c87a0c39a860e19eee41815737e38b2a035c040
tree10e58f6c776441efb9fb3266303b129eadc3a02c
parenta0022a38be1017fb302563eaee54ff904be48cea
nfsd: adjust number of running nfsd threads based on activity

nfsd() is changed to pass a timeout to svc_recv() when there is a min
number of threads set, and to handle error returns from it:

In the case of -ETIMEDOUT, if the service mutex can be taken (via
trylock), the thread becomes an RQ_VICTIM so that it will exit,
providing that the actual number of threads is above pool->sp_nrthrmin.

In the case of -EBUSY, if the actual number of threads is below
pool->sp_nrthrmax, it will attempt to start a new thread. This attempt
is gated on a new SP_TASK_STARTING pool flag that serializes thread
creation attempts within a pool, and further by mutex_trylock().

Neil says: "I think we want memory pressure to be able to push a thread
into returning -ETIMEDOUT.  That can come later."

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfssvc.c
fs/nfsd/trace.h