All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: Jeff Layton <jlayton@kernel.org>, NeilBrown <neil@brown.name>,
	 Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>,  Tom Talpey <tom@talpey.com>
Cc: Rick Macklem <rmacklem@uoguelph.ca>,
	linux-nfs@vger.kernel.org,  Chuck Lever <cel@kernel.org>
Subject: [PATCH v6 01/12] NFSD: Make the DRC size limit independent of page size
Date: Mon, 21 Sep 2026 09:22:27 -0400	[thread overview]
Message-ID: <20260921-duplicate-reply-cache-v6-1-db5e13fd9944@kernel.org> (raw)
In-Reply-To: <20260921-duplicate-reply-cache-v6-0-db5e13fd9944@kernel.org>

nfsd_cache_size_limit() takes the square root of the low-memory page
count and then shifts the result by the page size in KB. The shift
belongs under the root. A host with 64 KB pages has a page count 16
times smaller than a 4 KB host with the same memory, so its root is
4 times smaller and its shift 16 times larger, and the limit comes
out 4 times larger. With 8 GB of low memory the limit is 92672
entries on 4 KB pages and 370688 on 64 KB pages.

Take the root of the byte count instead. The result matches the
table above the function on every page size. Low memory on a 32-bit
host is under 1 GB, so the byte count fits in an unsigned long.

Fixes: 0338dd157282 ("nfsd: dynamically allocate DRC entries")
Suggested-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <cel@kernel.org>
---
 fs/nfsd/nfscache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index 80364b91331a..b43b276a92b3 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -73,7 +73,7 @@ nfsd_cache_size_limit(void)
 	unsigned int limit;
 	unsigned long low_pages = totalram_pages() - totalhigh_pages();
 
-	limit = (16 * int_sqrt(low_pages)) << (PAGE_SHIFT-10);
+	limit = int_sqrt(low_pages << PAGE_SHIFT);
 	return min_t(unsigned int, limit, 256*1024);
 }
 

-- 
2.55.0


  reply	other threads:[~2026-09-21 13:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 13:22 [PATCH v6 00/12] Improve the scalability of NFSD's classic DRC Chuck Lever
2026-09-21 13:22 ` Chuck Lever [this message]
2026-09-21 13:22 ` [PATCH v6 02/12] NFSD: Remove hard cap on duplicate reply cache size Chuck Lever
2026-09-21 13:22 ` [PATCH v6 03/12] SUNRPC: Assign a unique identifier to each svc_xprt Chuck Lever
2026-09-21 13:22 ` [PATCH v6 04/12] NFSD: Track transport in DRC entries Chuck Lever
2026-09-21 13:22 ` [PATCH v6 05/12] NFSD: Prepare bucket pruning for additional eviction reasons Chuck Lever
2026-09-21 13:22 ` [PATCH v6 06/12] NFSD: Add tracepoints for DRC entry eviction Chuck Lever
2026-09-21 13:22 ` [PATCH v6 07/12] NFSD: Record DRC population in lookup tracepoints Chuck Lever
2026-09-21 13:22 ` [PATCH v6 08/12] SUNRPC: Publish reply positions for upper-layer consumers Chuck Lever
2026-09-21 13:22 ` [PATCH v6 09/12] SUNRPC: Publish TCP reply positions Chuck Lever
2026-09-21 13:22 ` [PATCH v6 10/12] svcrdma: Publish RDMA " Chuck Lever
2026-09-21 13:22 ` [PATCH v6 11/12] NFSD: Evict acknowledged DRC entries Chuck Lever
2026-09-21 13:22 ` [PATCH v6 12/12] NFSD: Remove DRC checksum and payload_misses stat Chuck Lever
2026-09-23 14:56   ` Jeff Layton
2026-09-23 16:36     ` Chuck Lever
2026-09-22  6:55 ` [PATCH v6 00/12] Improve the scalability of NFSD's classic DRC NeilBrown

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=20260921-duplicate-reply-cache-v6-1-db5e13fd9944@kernel.org \
    --to=cel@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=rmacklem@uoguelph.ca \
    --cc=tom@talpey.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.