]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sunrpc: track the max number of requested threads in a pool
authorJeff Layton <jlayton@kernel.org>
Tue, 6 Jan 2026 18:59:45 +0000 (13:59 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Wed, 28 Jan 2026 15:15:42 +0000 (10:15 -0500)
The kernel currently tracks the number of threads running in a pool in
the "sp_nrthreads" field. In the future, where threads are dynamically
spun up and down, it'll be necessary to keep track of the maximum number
of requested threads separately from the actual number running.

Add a pool->sp_nrthrmax parameter to track this. When userland changes
the number of threads in a pool, update that value accordingly.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/svc.h
net/sunrpc/svc.c

index 2676bf276d6ba43772ecee65b94207b438168679..ec2b6ef5482352e61a9861a19f0ae4a610985ae9 100644 (file)
@@ -35,8 +35,9 @@
  */
 struct svc_pool {
        unsigned int            sp_id;          /* pool id; also node id on NUMA */
+       unsigned int            sp_nrthreads;   /* # of threads currently running in pool */
+       unsigned int            sp_nrthrmax;    /* Max requested number of threads in pool */
        struct lwq              sp_xprts;       /* pending transports */
-       unsigned int            sp_nrthreads;   /* # of threads in pool */
        struct list_head        sp_all_threads; /* all server threads */
        struct llist_head       sp_idle_threads; /* idle server threads */
 
index 4d68d1dfe7c297913dd836644c5fb7e2794cb210..dd22906705f1a3105b74db25a4f5750cb17f7a67 100644 (file)
@@ -839,6 +839,7 @@ svc_set_pool_threads(struct svc_serv *serv, struct svc_pool *pool,
        if (!pool)
                return -EINVAL;
 
+       pool->sp_nrthrmax = nrservs;
        delta -= pool->sp_nrthreads;
 
        if (delta > 0)