Article View: linux.kernel.netdev
Article #10987[PATCH v8 06/14] NFSD: Prepare bucket pruning for additional eviction reasons
From: Chuck Lever
Date: Wed, 04 Nov 2026 14:11
Date: Wed, 04 Nov 2026 14:11
41 lines
10275 bytes
10275 bytes
nfsd_prune_bucket_locked() combines its two eviction reasons,
memory pressure and RC_EXPIRE, in a single test and stops the walk
at the first entry the test does not evict. A reason that needs
its own handling, a tracepoint per reason or a test that must run
ahead of the stop, has nowhere to go.
Test each reason on its own and jump to a shared eviction label.
The walk still stops at the first entry no reason applies to.
Reviewed-by: NeilBrown <neil@brown.name>
Link: https://patch.msgid.link/20260921-duplicate-reply-cache-v6-5-db5e13fd9944@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
---
fs/nfsd/nfscache.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index 01ad6a9ebe1f..988b955590cc 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -274,10 +274,13 @@ nfsd_prune_bucket_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b,
/* The bucket LRU is ordered oldest-first. */
list_for_each_entry_safe(rp, tmp, &b->lru_head, c_lru) {
- if (atomic_read(&nn->num_drc_entries) <= nn->max_drc_entries &&
- time_before(expiry, rp->c_timestamp))
- break;
+ if (atomic_read(&nn->num_drc_entries) > nn->max_drc_entries)
+ goto evict;
+ if (time_before_eq(rp->c_timestamp, expiry))
+ goto evict;
+ break;
+evict:
nfsd_cacherep_unlink_locked(nn, b, rp);
list_add(&rp->c_lru, dispose);
--
2.56.0
Technical Details
Message-ID:
<20261104-duplicate-reply-cache-v8-6-eea5b90e4318@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356480-linux-kernel-netdev=dewy.ruReferences:
<20261104-duplicate-reply-cache-v8-0-eea5b90e4318@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356480-linux-kernel-netdev=dewy.ru From: cel@kernel.org (Chuck Lever) Newsgroups: linux.kernel.netdev Subject: [PATCH v8 06/14] NFSD: Prepare bucket pruning for additional eviction reasons Date: Wed, 04 Nov 2026 09:11:06 -0500 Organization: Usenet Network Message-ID: <20261104-duplicate-reply-cache-v8-6-eea5b90e4318@kernel.org> References: <20261104-duplicate-reply-cache-v8-0-eea5b90e4318@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3406414"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:5TX03MnZs8FJdiK/1ieutwfejis= sha256:GvLVqpAxfo9435MuDJPpxyIHz2Nlzz2qSm6UaKmsegs= sha1:Y12SSN2hGsKtIxzQb67rin1VKLc= sha256:sP9v+RUfNCQdN1itcrWaxZ4hl/Kj/p0pl6ieVus+/Q8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id C1B56112BEC; Wed, 4 Nov 2026 17:17:26 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rLYg_VkAo5CP; Wed, 4 Nov 2026 17:17:22 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-356480-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id D1ADD112BF0; Wed, 4 Nov 2026 17:17:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 122A960D414; Wed, 4 Nov 2026 14:11:55 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793801488; b=El5xl+FnmqY3TXG7czSEv38WIzGk1bT6cl7M9DTyxtCVQRKnmGHJqzAnk7ohYmm5bgbg yHXuKhHuDoJ3FitUYfThb0le+MG3Am2o3Vf2nsT1OomJPO8jH5+bnMfeLm3VQzPQIKude WGrJL5aEMRXGKiU9xZlHK4fLrJrXRNqsxb8lqd58CT9taM2/1yIP0w84j/SASFBndC49A quld1pLHoSJczTU2nzTNz+kSwsyLMiChjgSBbAD8Qmiidy3BRVoHV1Ig6JxlN6+vzK5UT 7h5Tm9+A5fxLFBnyHBZDgrfDocOUK3ymGdcqKaO1XHzf67HIXo69dmX0MYmYvluZ+uw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793801488; h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=3fGh67PErge46ER3pud+qERHkhA18TH9j6ch4ZdnSt4=; b=H6WsJe/ZCaiOa3RBnZS6fhBJK3/gpf3nUFwgrZRE3Tj5mmA4fxQfTs0LoNaWJ3xwhVQp STjsuI0PfGqNEEeZtJ7PVCxO31Mph1oc2fjYBEC5hfj7jq723L/MtmDsFt5Uyyg5bjJjb cpJrJHL9eyd4ToSg/Gsg3MPewnicMzo1r9XkrXTxvQj4tu7MLPj7kmrXdlmaayZwYR8nt 0i1/c70/cIzoqup5K5Xew/J2THOQK2Fp8aWi4B9jvln+i8EjOczZf3hNqG6AcUCqXQF1w bHnWkPkT3VKb1Wi1Ib9VgglRtmYUL1EZrX1aQmgjY2Gq6i0iVcFduzNUSkTddnU00Eg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=njIhyBWA; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3ADB0606D81F; Wed, 4 Nov 2026 14:11:28 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=njIhyBWA X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793801482; b=z4Y4YpniHvfV299XY3NJ8vSVByG3ofHofI2KYYFOj1RDAWBkrpvMnuqVEIWaDv6aaQ/z w0GaZCrBeWoAc1SSTQ/H/wHDVNPr+/g9d72Rqtw70A7KwJCQMUBx8qe7Yn69rRu194ze7 ZmuLrMaRCwBQHMyhOWnEt1s6E65wmtHzsiuvPaOopoCovbC0bW4ERRI7rM16YPKFWzrfB CO+vliq1lYPQSJ2UYd3fsQpYTr22UAZEFbC+NtfKRQQmuZz6lLrWy2UiWulMzDwD1XgMc 9Dnyp+fOJ1adTT9d9TbUlVXv/D34ND2gTaISmjXnUFv216inIN1hVBVlunacikti3WA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793801482; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=3fGh67PErge46ER3pud+qERHkhA18TH9j6ch4ZdnSt4=; b=TLehBVMGV2mg+bAAwBqn+FsrSpNyFSsjWh5i5QBMZc7jJqr2xl762z0UnphXU29ukyxs meFxrdg2WwtRvJFbUaZ/CVhtzqqRSa+A6mEltOduCVTtoOxCYG3HzhRAeD+j37xe3cFC9 VKIfwSmnOyurqvTK+BFeHXTbr+5P+uHTSH20+cSv08PMTqGmMpdvavtsRLXR99e5bpmla wpxoIFD/Lu5RY1DiKKfWR+1el830UuLGqGKRNowGoZxxW+EQZNHOxNCz/5m1y5IB9ZrzG rgx3cMMrqFjeMs7E7Ws1atYKZfoXgRY81t6SSFYqIJXWjowlJkUA1tVGN/KUc3GCaBQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=njIhyBWA; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E31F606EE85; Wed, 4 Nov 2026 14:11:22 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35EAF1F00A1E; Wed, 4 Nov 2026 14:11:21 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793801482; bh=3fGh67PErge46ER3pud+qERHkhA18TH9j6ch4ZdnSt4=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=njIhyBWAT14etXFWjKXBOT21qryUfnNfSiX9pX4BPM0CPySHmxPMkOGsiNFIeLWJe vsIGlHaaqhnBLbKSdxtLmAx0AS25sGgNDTwffxSgla+PH6qfvBnRl1IdvDpWviBJW0 UKIlbyrHJ/AHy1PAgGbSRABH/7azmZgv/YZlWQVfpgl8jiWLOnnDwUlzxIfjQS26jO JO8AwngVg+45cHrEZNl5qZp/8n0rqk/ij3sxgJXOSOYMAnvp/Zlj2HUx41Y8aMQYg0 BGenaj1caInDuk1Yf9y3qHP9VHeeq2oFCbn+xsW8aXmIkTGVCZVhKCCRJQzyEddz81 DdLdigyUtyJoQ== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261104-duplicate-reply-cache-v8-0-eea5b90e4318@kernel.org> X-Cc: Rick Macklem <rmacklem@uoguelph.ca>, linux-nfs@vger.kernel.org, netdev@vger.kernel.org, Chuck Lever <cel@kernel.org> X-Mailer: b4 0.17-dev-9c833 X-Developer-Signature: v=1; a=openpgp-sha256; l=1455; i=cel@kernel.org; h=from:subject:message-id; bh=UFXVU3zy18XoNoHOmBblSyNW/iYRGlM3crhR8t8x4Q0=; b=owEBbQKS/ZANAwAKATNqszNvZn+XAcsmYgBq6z0ARR+rq56+2RekttHqR+AT/o5W9zoHv/GMt BBReyHFa4aJAjMEAAEKAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCaus9AAAKCRAzarMzb2Z/ lyKbD/4ro+YUAQZFRtwTyh1t9dSZgh81pHtybdlsyOFDqVbVsPmTLT0hml85BBK/WLD1RRw31rh VOSpBvxHV/hCMRkimiouc++5Q6V6T0j55h0Ds8RViMjIpHJmyVScqW44ePLQjGbYb6QV/XRx9zm aFo0+zciPzB+ofMXbb38pZMUbQ96pwn5oz8rlB3ltS1sumv9ZfkqGKWpl6sxWYcSvmKeij2kwzS B7ZpNGUDcUedJDToJWnISV6I2ngjoZacaBnJrPWibgWwO53uKkCf8r5rJUhxF/d1x+ZhGpSvZ1I hdoXQ2l3AhOedrM0jUN7jScTsYVH3JEjXp1UE3A2UNDE8dwlxqb+MzfHFrIgvDSQzrcpvoHTmkh l7lVIvBZX/dOGBZ+nvak9E6bUouepObDn4WAAlFcX517mcTd2HGwxSuT0dE5h0Y+cv9NHRXjsGA vcPx7sVa7XtkJnf09JX3oaczvGARJ2+4NmO30VTTR6qRqr6GYSd4p0hzhxA+w1zHN7mMkbesZzJ 5r4Gl7CEt6E35cl3/yJTdme+d8J2ixEjJTexmDUyd10w5kJFlyv3u5EWbTcI+wwUuKoKZCUfzWs UuFlI34UOEBuoWzZD73OIfu0R37omuG0KSfkFDsKkQkkkZ83bDVxkV1yizBbnHzKUlKkQcBlJ+9 2bfQjh7xgk6YLqA== X-Developer-Key: i=cel@kernel.org; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97