All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org, netdev@vger.kernel.org
Cc: david@fromorbit.com, jlayton@redhat.com, tgraf@suug.ch
Subject: [PATCH v2 16/31] NFSD: Fix the filecache LRU shrinker
Date: Tue, 28 Jun 2022 14:07:30 -0400	[thread overview]
Message-ID: <165643965013.84360.5320447476976778288.stgit@manet.1015granger.net> (raw)
In-Reply-To: <165643915086.84360.2809940286726976517.stgit@manet.1015granger.net>

Without LRU item rotation, the shrinker visits only a few items on
the end of the LRU list, and those would always be long-term OPEN
files for NFSv4 workloads. That makes the filecache shrinker
completely ineffective.

Adopt the same strategy as the inode LRU by using LRU_ROTATE.

Suggested-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/filecache.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 6e9e186334ab..bd6ba63f69ae 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -452,6 +452,7 @@ nfsd_file_dispose_list_delayed(struct list_head *dispose)
  *
  * Return values:
  *   %LRU_REMOVED: @item was removed from the LRU
+ *   %LRU_ROTATED: @item is to be moved to the LRU tail
  *   %LRU_SKIP: @item cannot be evicted
  */
 static enum lru_status
@@ -490,7 +491,7 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru,
 
 	if (test_and_clear_bit(NFSD_FILE_REFERENCED, &nf->nf_flags)) {
 		trace_nfsd_file_gc_referenced(nf);
-		return LRU_SKIP;
+		return LRU_ROTATE;
 	}
 
 	if (!test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
@@ -532,7 +533,7 @@ nfsd_file_gc(void)
 	unsigned long ret;
 
 	ret = list_lru_walk(&nfsd_file_lru, nfsd_file_lru_cb,
-			    &dispose, LONG_MAX);
+			    &dispose, list_lru_count(&nfsd_file_lru));
 	trace_nfsd_file_gc_removed(ret, list_lru_count(&nfsd_file_lru));
 	nfsd_file_gc_dispose_list(&dispose);
 }



  parent reply	other threads:[~2022-06-28 18:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 18:05 [PATCH v2 00/31] Overhaul NFSD filecache Chuck Lever
2022-06-28 18:05 ` [PATCH v2 01/31] NFSD: Demote a WARN to a pr_warn() Chuck Lever
2022-06-28 18:05 ` [PATCH v2 02/31] NFSD: Report filecache LRU size Chuck Lever
2022-06-28 18:06 ` [PATCH v2 03/31] NFSD: Report count of calls to nfsd_file_acquire() Chuck Lever
2022-06-28 18:06 ` [PATCH v2 04/31] NFSD: Report count of freed filecache items Chuck Lever
2022-06-28 18:06 ` [PATCH v2 05/31] NFSD: Report average age of " Chuck Lever
2022-06-28 18:06 ` [PATCH v2 06/31] NFSD: Add nfsd_file_lru_dispose_list() helper Chuck Lever
2022-06-28 18:06 ` [PATCH v2 07/31] NFSD: Refactor nfsd_file_gc() Chuck Lever
2022-06-28 18:06 ` [PATCH v2 08/31] NFSD: Refactor nfsd_file_lru_scan() Chuck Lever
2022-06-28 18:06 ` [PATCH v2 09/31] NFSD: Report the number of items evicted by the LRU walk Chuck Lever
2022-06-28 18:06 ` [PATCH v2 10/31] NFSD: Record number of flush calls Chuck Lever
2022-06-28 18:06 ` [PATCH v2 11/31] NFSD: Zero counters when the filecache is re-initialized Chuck Lever
2022-06-28 18:07 ` [PATCH v2 12/31] NFSD: Hook up the filecache stat file Chuck Lever
2022-06-28 18:07 ` [PATCH v2 13/31] NFSD: WARN when freeing an item still linked via nf_lru Chuck Lever
2022-06-28 18:07 ` [PATCH v2 14/31] NFSD: Trace filecache LRU activity Chuck Lever
2022-06-28 18:07 ` [PATCH v2 15/31] NFSD: Leave open files out of the filecache LRU Chuck Lever
2022-06-28 18:07 ` Chuck Lever [this message]
2022-06-28 18:07 ` [PATCH v2 17/31] NFSD: Never call nfsd_file_gc() in foreground paths Chuck Lever
2022-06-28 18:07 ` [PATCH v2 18/31] NFSD: No longer record nf_hashval in the trace log Chuck Lever
2022-06-28 18:07 ` [PATCH v2 19/31] NFSD: Remove lockdep assertion from unhash_and_release_locked() Chuck Lever
2022-06-28 18:07 ` [PATCH v2 20/31] NFSD: nfsd_file_unhash can compute hashval from nf->nf_inode Chuck Lever
2022-06-28 18:08 ` [PATCH v2 21/31] NFSD: Refactor __nfsd_file_close_inode() Chuck Lever
2022-06-28 18:08 ` [PATCH v2 22/31] NFSD: nfsd_file_hash_remove can compute hashval Chuck Lever
2022-06-28 18:08 ` [PATCH v2 23/31] NFSD: Remove nfsd_file::nf_hashval Chuck Lever
2022-06-28 18:08 ` [PATCH v2 24/31] NFSD: Replace the "init once" mechanism Chuck Lever
2022-06-28 18:08 ` [PATCH v2 25/31] NFSD: Set up an rhashtable for the filecache Chuck Lever
2022-06-28 18:08 ` [PATCH v2 26/31] NFSD: Convert the filecache to use rhashtable Chuck Lever
2022-06-28 18:08 ` [PATCH v2 27/31] NFSD: Clean up unused code after rhashtable conversion Chuck Lever
2022-06-28 18:08 ` [PATCH v2 28/31] NFSD: Separate tracepoints for acquire and create Chuck Lever
2022-06-28 18:08 ` [PATCH v2 29/31] NFSD: Move nfsd_file_trace_alloc() tracepoint Chuck Lever
2022-06-28 18:09 ` [PATCH v2 30/31] NFSD: Update the nfsd_file_fsnotify_handle_event() tracepoint Chuck Lever
2022-06-28 18:09 ` [PATCH v2 31/31] NFSD: NFSv4 CLOSE should release an nfsd_file immediately Chuck Lever

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=165643965013.84360.5320447476976778288.stgit@manet.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=david@fromorbit.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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.