From: Chuck Lever <cel@kernel.org>
To: NeilBrown <neil@brown.name>
Cc: Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v1 1/2] NFSD: Delay adding new entries to LRU
Date: Thu, 21 Aug 2025 09:36:38 -0400 [thread overview]
Message-ID: <65dbe447-8528-435f-930f-4a773a85a512@kernel.org> (raw)
In-Reply-To: <175573005510.2234665.16962394280504152867@noble.neil.brown.name>
On 8/20/25 6:47 PM, NeilBrown wrote:
> On Thu, 21 Aug 2025, Chuck Lever wrote:
>> From: Chuck Lever <chuck.lever@oracle.com>
>>
>> Neil Brown observes:
>>> I would not include RC_INPROG entries in the lru at all - they are
>>> always ignored, and will be added when they are switched to
>>> RCU_DONE.
>>
>> I also removed a stale comment.
>>
>> Suggested-by: NeilBrown <neil@brown.name>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>> fs/nfsd/nfscache.c | 6 ------
>> 1 file changed, 6 deletions(-)
>>
>> diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
>> index ba9d326b3de6..6c06cf24b5c7 100644
>> --- a/fs/nfsd/nfscache.c
>> +++ b/fs/nfsd/nfscache.c
>> @@ -237,10 +237,6 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn)
>>
>> }
>>
>> -/*
>> - * Move cache entry to end of LRU list, and queue the cleaner to run if it's
>> - * not already scheduled.
>> - */
>> static void
>> lru_put_end(struct nfsd_drc_bucket *b, struct nfsd_cacherep *rp)
>> {
>> @@ -453,8 +449,6 @@ nfsd_cache_insert(struct nfsd_drc_bucket *b, struct nfsd_cacherep *key,
>> nn->longest_chain_cachesize,
>> atomic_read(&nn->num_drc_entries));
>> }
>> -
>> - lru_put_end(b, ret);
>> return ret;
>
> A result of this change is that entries in the lru never have
> ->c_state == RC_INPROG
> They are always RC_DONE.
>
> So this can be added to the patch:
>
> --- a/fs/nfsd/nfscache.c
> +++ b/fs/nfsd/nfscache.c
> @@ -272,12 +272,6 @@ 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) {
> - /*
> - * Don't free entries attached to calls that are still
> - * in-progress, but do keep scanning the list.
> - */
> - if (rp->c_state == RC_INPROG)
> - continue;
>
> if (atomic_read(&nn->num_drc_entries) <= nn->max_drc_entries &&
> time_before(expiry, rp->c_timestamp))
I didn't add this bit because I couldn't convince myself that it was
impossible for an entry in RC_INPROG state to get into the LRU
somehow. But if you think it is not possible, I'll buy that and add this
snippet.
> With that added:
>
> Reviewed-by: NeilBrown <neil@brown.name>
>
> Thanks,
> NeilBrown
>
>
>> }
>>
>> --
>> 2.50.0
>>
>>
>
--
Chuck Lever
next prev parent reply other threads:[~2025-08-21 13:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 14:25 [PATCH v1 0/2] NFSD duplicate reply cache optimizations Chuck Lever
2025-08-20 14:25 ` [PATCH v1 1/2] NFSD: Delay adding new entries to LRU Chuck Lever
2025-08-20 22:47 ` NeilBrown
2025-08-21 13:36 ` Chuck Lever [this message]
2025-08-20 14:25 ` [PATCH v1 2/2] NFSD: Reduce DRC bucket size Chuck Lever
2025-08-20 14:34 ` [PATCH v1 0/2] NFSD duplicate reply cache optimizations Jeff Layton
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=65dbe447-8528-435f-930f-4a773a85a512@kernel.org \
--to=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--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.