mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, NeilBrown <neil@brown.name>,
	 Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>,  Tom Talpey <tom@talpey.com>,
	Trond Myklebust <trondmy@kernel.org>,
	 Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Jeff Layton <jlayton@kernel.org>
Subject: [PATCH v2 3/8] sunrpc: track the max number of requested threads in a pool
Date: Tue, 06 Jan 2026 13:59:45 -0500	[thread overview]
Message-ID: <20260106-nfsd-dynathread-v2-3-416e5f27b2b6@kernel.org> (raw)
In-Reply-To: <20260106-nfsd-dynathread-v2-0-416e5f27b2b6@kernel.org>

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>
---
 include/linux/sunrpc/svc.h | 3 ++-
 net/sunrpc/svc.c           | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 2676bf276d6ba43772ecee65b94207b438168679..ec2b6ef5482352e61a9861a19f0ae4a610985ae9 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -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 */
 
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index fd52ebec0655f2289d792f4aac02859d90d290fd..1f6c0da4b7da0acf8db88dc60e790c955d200c96 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -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)

-- 
2.52.0


  parent reply	other threads:[~2026-01-06 19:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06 18:59 [PATCH v2 0/8] nfsd, sunrpc: allow for a dynamically-sized threadpool Jeff Layton
2026-01-06 18:59 ` [PATCH v2 1/8] sunrpc: split svc_set_num_threads() into two functions Jeff Layton
2026-01-06 18:59 ` [PATCH v2 2/8] sunrpc: remove special handling of NULL pool from svc_start/stop_kthreads() Jeff Layton
2026-01-06 18:59 ` Jeff Layton [this message]
2026-01-06 18:59 ` [PATCH v2 4/8] sunrpc: introduce the concept of a minimum number of threads per pool Jeff Layton
2026-01-06 18:59 ` [PATCH v2 5/8] sunrpc: split new thread creation into a separate function Jeff Layton
2026-01-06 18:59 ` [PATCH v2 6/8] sunrpc: allow svc_recv() to return -ETIMEDOUT and -EBUSY Jeff Layton
2026-01-06 18:59 ` [PATCH v2 7/8] nfsd: adjust number of running nfsd threads based on activity Jeff Layton
2026-01-06 18:59 ` [PATCH v2 8/8] nfsd: add controls to set the minimum number of threads per pool Jeff Layton
2026-01-06 21:26 ` [PATCH v2 0/8] nfsd, sunrpc: allow for a dynamically-sized threadpool Chuck Lever
2026-01-06 21:53   ` Jeff Layton
2026-01-08  0:28 ` Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260106-nfsd-dynathread-v2-3-416e5f27b2b6@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=anna@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®