From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 468A63939CF for ; Thu, 5 Feb 2026 10:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770285685; cv=none; b=PWYTlCXSFv1Wd4pb6vO5d/aafZuyZ0M5IV8GgaPUv2fa3/yN5sSyzdj4CERe4JUNGv744VKmEqkRR4VxTE6dn1wCSL0zgU0Gy9Es7ldrpY8ZrdFN8K3eleRh9pOppwjik+mvNXCETS9lewC1t4iSYfmtz+3kpscKstnHrwq+S+s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770285685; c=relaxed/simple; bh=K4cy3FM/CXSzvm3SPhsATbYIYGqm2Ogq7TUj5w3++M4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XBBjUz1lSqAOAF0GwJBJit722c8K3LKIVJfVp9lD5lMQ00K6IbEKIxfa31EvEjNYHi/7CWOfcFqJQCzKNXcSiZoTpisG6OwG811hR7U0P/uFygWytKlqCaLjjpqaKrYxxPY7ybm4NmtMlu+f0RCJvlkVH0Dcadl+WVnEZlKd+zU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eKBGmEXV; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eKBGmEXV" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-435a517be33so496073f8f.0 for ; Thu, 05 Feb 2026 02:01:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770285684; x=1770890484; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Wk91Xbv8qNmt7yfeObGK9VXjmHH50bJOgja/zUrERqI=; b=eKBGmEXVdfCEQ0nxKRtVhyr0e5MCmxkehD/4QAtgDp4QuH2gYblW7y83++0d/deGFm yJko/oqdWFI04//S3eUxPGi1FU9yDcJZidP5C5sau6AP0CToLMWX0qx835tE6HrJuJk/ OitZSDgiAUOqSnn9hIEMTkD5rAluqQ7pORw5Fa0ie094Pi3My0DipmbbgnFqIN4f4WPD OZ+eqlZttvbx0RxA2RZEC+FBENuIeGnYsiGiPKcSbGKHo09G3xESqur+jtVn1Ill7KjC es7CNX7qlOym5BGSJXdUqWpK3hJxo6k9O0pe94NcrVr+jFJZ3MOPcVYv/s7F2UzNgcRb nltQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770285684; x=1770890484; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Wk91Xbv8qNmt7yfeObGK9VXjmHH50bJOgja/zUrERqI=; b=ryp6t6t2+SCAXNjutcndhDvv13jMS/BUgv9KzqevbuRTvqgucYa9muXxU78STxDXpl WuK7sZ4FcIqDl581qXN+9Etk3hBHKREc0SulZHCcLgNHsaAlEryafHTH89locmO3Uulk 2ZVUkyhJnyG2k+QwuNNeL30+tCt9tTG/CcpQWDcVR8WRsLHRBhbCV0T/0k7vMyMmxLKu hlk+nhMum6b8KUtMJmrJTxMK17M1H0h6MkjC6F2RZnAYqiRy2DgO04Gc30bVdR3W+5AS t9oQ1sFEK5IFEf81LU/n2atkJkLQZu2mzcaMSnVYgbUE79wa/9jZWCNhokpQ40O8SZaW PIsw== X-Forwarded-Encrypted: i=1; AJvYcCUoAjnhZmEQtQ6EYd3Py2C4bTQffOGXfyn2yuHlAZ8UAMnBbfaW1/wPNOXhJk2JVqtjh2qYebH5lghoyoE=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8cSVOGZ/YKmhr/ooIrkWPmsqSr01raUQLabwgmOM9LLeSpnrM jtiFgfgUYLDeLpV0Fhs0XSXSr/3hCKhjqvt57a5VhsEOVzNF5a5r1v0T X-Gm-Gg: AZuq6aI3XyC/ytbh1Nhj4P3kkH6NpsEUfXbysbvTFWBd3RevCV60VuXRCYhpshrgtl7 d8SIAO3eJbWlLtI+/7qfIeAhhIRurQLdA3Nzxlx52CZe2bPUjTgeONxNQMeDk9vRtTfRUlE05xo mASnSvQfVZOnqjB6FgTblbMn/uZOO0/aC6zhwNI/mfLdIx07iLWcEmlW62NWifDBqCZQH2RZjLq srddA+HQydK5Bi/Oyrlyo6rzu+q13RKp4yb3DoDz6nP9F3pZ9tytzZiWVmOwmv//g10NxbDi3Ej eLeisdepxD12IWyHjr+bflLZCrKi/Z1+ZgLNCv1bKMOJ9CyPIialCVGn8mTguh81DlYoeyRwBsS hhYolwanjgkgYNmKT7+d8ELBXyVpbm0KK/szph3vMvXu3/YF0z+gVT6lM8C5DyrDjnmpyClcuJ/ oGtgXVuOEZjU2ILz2ppzByj4mCgSvpJqJN3qNzjKAt0jnae/0VfOzPCpUT+t2Jr9rbTxXPmYY= X-Received: by 2002:a05:6000:26c1:b0:436:2356:47d4 with SMTP id ffacd0b85a97d-436235649ebmr2101131f8f.39.1770285683346; Thu, 05 Feb 2026 02:01:23 -0800 (PST) Received: from [192.168.0.125] (cdmjno2.plus.com. [31.125.38.23]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43617e3a3a9sm12486132f8f.18.2026.02.05.02.01.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Feb 2026 02:01:22 -0800 (PST) Message-ID: <6944906a-9256-4f10-88fa-822a639eb5eb@gmail.com> Date: Thu, 5 Feb 2026 10:01:21 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] nfsd: report the requested maximum number of threads instead of number running To: Jeff Layton , Chuck Lever , Chuck Lever , NeilBrown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260204-minthreads-v1-1-7480176baf35@kernel.org> <2abf7a33-789f-405d-8993-8fbf30153aaa@app.fastmail.com> Content-Language: en-GB From: Mike Owen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, I currently rely on: "/proc/net/rpc/nfsd" to retrieve the current number of threads via "th": https://svennd.be/nfsd-stats-explained-procnetrpcnfsd/ After the various patches to introduce dynamic threading, where in the future, would a user retrieve the currently set min, max and actual running thread count reliably? Would be lovely if the man page indicated this. Thanks, Mike On 04/02/2026 19:13, Jeff Layton wrote: > On Wed, 2026-02-04 at 13:51 -0500, Chuck Lever wrote: >> >> On Wed, Feb 4, 2026, at 12:23 PM, Jeff Layton wrote: >>> The current netlink and /proc interfaces deviate from their traditional >>> values when dynamic threading is enabled, and there is currently no way >>> to know what the current setting is. This patch brings the reporting >>> back in line with traditional behavior. >>> >>> Make these interfaces report the requested maximum number of threads >>> instead of the number currently running. >>> >>> Fixes: d8316b837c2c ("nfsd: add controls to set the minimum number of >>> threads per pool") >>> Signed-off-by: Jeff Layton >>> --- >>> I think this is less surprising than the current behavior of what's in >>> Chuck's tree. We could also consider adding netlink attributes to report >>> the number of running threads, but you can get that info from ps too. >>> --- >>> fs/nfsd/nfsctl.c | 2 +- >>> fs/nfsd/nfssvc.c | 7 ++++--- >>> 2 files changed, 5 insertions(+), 4 deletions(-) >>> >>> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c >>> index >>> 4d8e3c1a7be3b3a4e4f5248b27b60d6b3ae88d51..178c7646b2e25630b85de937d7ced18947c047f9 >>> 100644 >>> --- a/fs/nfsd/nfsctl.c >>> +++ b/fs/nfsd/nfsctl.c >>> @@ -1700,7 +1700,7 @@ int nfsd_nl_threads_get_doit(struct sk_buff *skb, >>> struct genl_info *info) >>> struct svc_pool *sp = &nn->nfsd_serv->sv_pools[i]; >>> >>> err = nla_put_u32(skb, NFSD_A_SERVER_THREADS, >>> - sp->sp_nrthreads); >>> + sp->sp_nrthrmax); >>> if (err) >>> goto err_unlock; >>> } >>> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c >>> index >>> 8184514c58de8e396795cd4714a04d66d9637f17..be0add971c2d994948c3e8fca19bcf6f3c75dfaf >>> 100644 >>> --- a/fs/nfsd/nfssvc.c >>> +++ b/fs/nfsd/nfssvc.c >>> @@ -239,12 +239,13 @@ static void nfsd_net_free(struct percpu_ref *ref) >>> >>> int nfsd_nrthreads(struct net *net) >>> { >>> - int rv = 0; >>> + int i, rv = 0; >>> struct nfsd_net *nn = net_generic(net, nfsd_net_id); >>> >>> mutex_lock(&nfsd_mutex); >>> if (nn->nfsd_serv) >>> - rv = nn->nfsd_serv->sv_nrthreads; >>> + for (i = 0; i < nn->nfsd_serv->sv_nrpools; ++i) >>> + rv += nn->nfsd_serv->sv_pools[i].sp_nrthrmax; >>> mutex_unlock(&nfsd_mutex); >>> return rv; >>> } >>> @@ -673,7 +674,7 @@ int nfsd_get_nrthreads(int n, int *nthreads, struct >>> net *net) >>> >>> if (serv) >>> for (i = 0; i < serv->sv_nrpools && i < n; i++) >>> - nthreads[i] = serv->sv_pools[i].sp_nrthreads; >>> + nthreads[i] = serv->sv_pools[i].sp_nrthrmax; >>> return 0; >>> } >> >> AI code review observes that: >> >> The documentation should be updated to reflect that these interfaces >> now report the configured maximum threads rather than running threads: >> >> 1. Documentation/netlink/specs/nfsd.yaml line 168 - threads-get is >> documented as "get the number of running threads" but now returns >> the configured maximum >> 2. fs/nfsd/nfsctl.c lines 387-405 - The write_threads() docstring >> says it reports "the number of running NFSD threads" but now >> reports the configured maximum >> 3. fs/nfsd/nfsctl.c lines 1666-1673 - The nfsd_nl_threads_get_doit() >> docstring says "get the number of running threads" >> > > Ok, I'll do that for v2. > > Thanks,