From: Jeff Layton <jlayton@kernel.org>
To: chuck.lever@oracle.com
Cc: neilb@suse.de, linux-nfs@vger.kernel.org
Subject: [PATCH v5 5/5] nfsd: fix up the filecache laundrette scheduling
Date: Tue, 1 Nov 2022 10:46:47 -0400 [thread overview]
Message-ID: <20221101144647.136696-6-jlayton@kernel.org> (raw)
In-Reply-To: <20221101144647.136696-1-jlayton@kernel.org>
We don't really care whether there are hashed entries when it comes to
scheduling the laundrette. They might all be non-gc entries, after all.
We only want to schedule it if there are entries on the LRU.
Switch to using list_lru_count, and move the check into
nfsd_file_gc_worker. The other callsite in nfsd_file_put doesn't need to
count entries, since it only schedules the laundrette after adding an
entry to the LRU.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfsd/filecache.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index bcea201d79c3..a47b5b39111a 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -187,12 +187,9 @@ static const struct rhashtable_params nfsd_file_rhash_params = {
static void
nfsd_file_schedule_laundrette(void)
{
- if ((atomic_read(&nfsd_file_rhash_tbl.nelems) == 0) ||
- test_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags) == 0)
- return;
-
- queue_delayed_work(system_wq, &nfsd_filecache_laundrette,
- NFSD_LAUNDRETTE_DELAY);
+ if (test_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags))
+ queue_delayed_work(system_wq, &nfsd_filecache_laundrette,
+ NFSD_LAUNDRETTE_DELAY);
}
static void
@@ -646,7 +643,8 @@ static void
nfsd_file_gc_worker(struct work_struct *work)
{
nfsd_file_gc();
- nfsd_file_schedule_laundrette();
+ if (list_lru_count(&nfsd_file_lru))
+ nfsd_file_schedule_laundrette();
}
static unsigned long
--
2.38.1
prev parent reply other threads:[~2022-11-01 14:46 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 14:46 [PATCH v5 0/5] nfsd: clean up refcounting in the filecache Jeff Layton
2022-11-01 14:46 ` [PATCH v5 1/5] nfsd: remove the pages_flushed statistic from filecache Jeff Layton
2022-11-01 14:46 ` [PATCH v5 2/5] nfsd: reorganize filecache.c Jeff Layton
2022-11-01 20:59 ` NeilBrown
2022-11-01 21:04 ` Jeff Layton
2022-11-01 14:46 ` [PATCH v5 3/5] nfsd: rework refcounting in filecache Jeff Layton
2022-11-01 17:25 ` Chuck Lever III
2022-11-01 18:03 ` Jeff Layton
2022-11-01 18:57 ` Jeff Layton
2022-11-01 19:13 ` Chuck Lever III
2022-11-01 20:21 ` Jeff Layton
2022-11-01 18:15 ` Jeff Layton
2022-11-01 21:23 ` NeilBrown
2022-11-01 21:39 ` Jeff Layton
2022-11-01 21:49 ` Chuck Lever III
2022-11-01 22:04 ` Chuck Lever III
2022-11-01 22:05 ` NeilBrown
2022-11-01 22:42 ` Jeff Layton
2022-11-02 16:58 ` Jeff Layton
2022-11-02 18:07 ` Chuck Lever III
2022-11-02 18:29 ` Chuck Lever III
2022-11-02 18:34 ` Jeff Layton
2023-01-17 15:16 ` Jason Gunthorpe
2023-01-17 15:22 ` Chuck Lever III
2023-01-17 15:59 ` Jeff Layton
2023-01-18 16:48 ` Shachar Kagan
2023-01-18 17:18 ` Jeff Layton
2023-01-18 18:41 ` Chuck Lever III
2022-11-01 14:46 ` [PATCH v5 4/5] nfsd: close race between unhashing and LRU addition Jeff Layton
2022-11-01 19:45 ` Chuck Lever III
2022-11-01 21:12 ` Chuck Lever III
2022-11-01 14:46 ` Jeff Layton [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=20221101144647.136696-6-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
/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.