public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: NeilBrown <neilb@suse.de>
Cc: linux-nfs@vger.kernel.org,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
	Jeff Layton <jlayton@kernel.org>
Subject: Re: [PATCH 0/4] nfsd: filecache: change garbage collect lists
Date: Thu, 23 Jan 2025 09:29:05 -0500	[thread overview]
Message-ID: <22f89ff9-5fe5-4691-943c-28fbc291677f@oracle.com> (raw)
In-Reply-To: <173758417063.22054.674648092957982688@noble.neil.brown.name>

On 1/22/25 5:16 PM, NeilBrown wrote:
> On Thu, 23 Jan 2025, Chuck Lever wrote:
>> On 1/21/25 10:54 PM, NeilBrown wrote:
>>>
>>> The nfsd filecache currently uses  list_lru for tracking files recently
>>> used in NFSv3 requests which need to be "garbage collected" when they
>>> have becoming idle - unused for 2-4 seconds.
>>>
>>> I do not believe list_lru is a good tool for this.  It does no allow the
>>> timeout which filecache requires so we have to add a timeout mechanism
>>> which holds the list_lru for while the whole list is scanned looking for
>>> entries that haven't been recently accessed.  When the list is largish
>>> (even a few hundred) this can block new requests which need the lock to
>>> remove a file to access it.
>>>
>>> This patch removes the list_lru and instead uses 2 simple linked lists.
>>> When a file is accessed it is removed from whichever list it is one,
>>> then added to the tail of the first list.  Every 2 seconds the second
>>> list is moved to the "freeme" list and the first list is moved to the
>>> second list.  This avoids any need to walk a list to find old entries.
>>>
>>> These lists are per-netns rather than global as the freeme list is
>>> per-netns as the actual freeing is done in nfsd threads which are
>>> per-netns.
>>>
>>> This should not be applied until we resolve how to handle the
>>> race-detection code in nfsd_file_put().  However I'm posting it now to
>>> get any feedback so that a final version can be posted as soon as that
>>> issue is resolved.
>>>
>>> Thanks,
>>> NeilBrown
>>>
>>>
>>>    [PATCH 1/4] nfsd: filecache: use nfsd_file_dispose_list() in
>>>    [PATCH 2/4] nfsd: filecache: move globals nfsd_file_lru and
>>>    [PATCH 3/4] nfsd: filecache: change garbage collection list
>>>    [PATCH 4/4] nfsd: filecache: change garbage collection to a timer.
>>
>> Hi Neil -
>>
>> I would like Dave Chinner to chime in on this approach. When you
>> resend, please Cc: him. Thanks!
> 
> Sure, I can do that.  But why Dave in particular?
> I would like to add a comment to the cover letter explaining to Dave
> what he was added to see and I don't know what to say.

Dave helped me with edead3a55804 ("NFSD: Fix the filecache LRU
shrinker") and a few other related fixes, and he is the original
author of the list_lru facility (see a38e40824844 ("list: add a new LRU
list type"). He might have additional insight on whether the filecache's
use of list_lru is salvageable or how a replacement of that mechanism
should work.


-- 
Chuck Lever

      reply	other threads:[~2025-01-23 14:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22  3:54 [PATCH 0/4] nfsd: filecache: change garbage collect lists NeilBrown
2025-01-22  3:54 ` [PATCH 1/4] nfsd: filecache: use nfsd_file_dispose_list() in nfsd_file_close_inode_sync() NeilBrown
2025-01-22 18:58   ` Jeff Layton
2025-01-22  3:54 ` [PATCH 2/4] nfsd: filecache: move globals nfsd_file_lru and nfsd_file_shrinker to be per-net NeilBrown
2025-01-22 18:58   ` Jeff Layton
2025-01-22 21:41   ` Chuck Lever
2025-01-22 22:10     ` NeilBrown
2025-01-23 14:30       ` Chuck Lever
2025-01-26 22:33         ` NeilBrown
2025-01-27 13:35           ` Chuck Lever
2025-01-27 22:21             ` NeilBrown
2025-01-22  3:54 ` [PATCH 3/4] nfsd: filecache: change garbage collection list management NeilBrown
2025-01-22 18:58   ` Jeff Layton
2025-01-22 21:14     ` NeilBrown
2025-01-22 21:33       ` Jeff Layton
2025-01-22  3:54 ` [PATCH 4/4] nfsd: filecache: change garbage collection to a timer NeilBrown
2025-01-22 19:08   ` Jeff Layton
2025-01-22 20:39     ` NeilBrown
2025-01-22 20:46       ` Jeff Layton
2025-01-22 21:07         ` NeilBrown
2025-01-22 19:22 ` [PATCH 0/4] nfsd: filecache: change garbage collect lists Chuck Lever
2025-01-22 22:16   ` NeilBrown
2025-01-23 14:29     ` Chuck Lever [this message]

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=22f89ff9-5fe5-4691-943c-28fbc291677f@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=Dai.Ngo@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox