From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever III <chuck.lever@oracle.com>
Cc: Neil Brown <neilb@suse.de>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v4 5/5] nfsd: start non-blocking writeback after adding nfsd_file to the LRU
Date: Tue, 01 Nov 2022 07:13:17 -0400 [thread overview]
Message-ID: <1f12f3c991bb11006571a36f292e7f5239a47b91.camel@kernel.org> (raw)
In-Reply-To: <3A83C32A-B851-49A5-8C6D-7CFB67B97136@oracle.com>
On Mon, 2022-10-31 at 21:00 +0000, Chuck Lever III wrote:
>
> > On Oct 31, 2022, at 7:37 AM, Jeff Layton <jlayton@kernel.org> wrote:
> >
> > When a GC entry gets added to the LRU, kick off SYNC_NONE writeback
> > so that we can be ready to close it when the time comes. This should
> > help minimize delays when freeing objects reaped from the LRU.
>
> Tested against a btrfs export.
>
> So, the current code does indeed do a synchronous fsync when
> garbage collecting files (via nfsd_file_delayed_close()).
> That indicates that it's at least safe to do, and 3/5 isn't
> changing the safety of the filecache by moving the vfs_fsync()
> call into nfsd_file_free(). These calls take between 10 and
> 20 milliseconds each.
>
> But I see the filemap_flush() call added here taking dozens of
> milliseconds on my system for large files. This is done before
> the WRITE reply is sent to the client, so it adds significant
> latency to large UNSTABLE WRITEs. In the current code, the
> vfs_fsync() in nfsd_file_put() does not seem to fire except in
> very rare circumstances, so it doesn't seem to have much if any
> impact.
>
> My scalability concerns therefore are with code that pre-dates
> this patch series. I can deal with that later in a separate
> series. Do we need to keep this one?
>
In the interest of getting the fixes in this series merged, let's just
drop this one for now. We can debate how to best handle this in a
follow-on series.
>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/nfsd/filecache.c | 23 +++++++++++++++++++++--
> > 1 file changed, 21 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> > index 47cdc6129a7b..c43b6cff03e2 100644
> > --- a/fs/nfsd/filecache.c
> > +++ b/fs/nfsd/filecache.c
> > @@ -325,6 +325,20 @@ nfsd_file_fsync(struct nfsd_file *nf)
> > nfsd_reset_write_verifier(net_generic(nf->nf_net, nfsd_net_id));
> > }
> >
> > +static void
> > +nfsd_file_flush(struct nfsd_file *nf)
> > +{
> > + struct file *file = nf->nf_file;
> > + struct address_space *mapping;
> > +
> > + if (!file || !(file->f_mode & FMODE_WRITE))
> > + return;
> > +
> > + mapping = file->f_mapping;
> > + if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
> > + filemap_flush(mapping);
> > +}
> > +
> > static int
> > nfsd_file_check_write_error(struct nfsd_file *nf)
> > {
> > @@ -484,9 +498,14 @@ nfsd_file_put(struct nfsd_file *nf)
> >
> > /* Try to add it to the LRU. If that fails, decrement. */
> > if (nfsd_file_lru_add(nf)) {
> > - /* If it's still hashed, we're done */
> > - if (test_bit(NFSD_FILE_HASHED, &nf->nf_flags))
> > + /*
> > + * If it's still hashed, we can just return now,
> > + * after kicking off SYNC_NONE writeback.
> > + */
> > + if (test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
> > + nfsd_file_flush(nf);
> > return;
> > + }
> >
> > /*
> > * We're racing with unhashing, so try to remove it from
> > --
> > 2.38.1
> >
>
> --
> Chuck Lever
>
>
>
--
Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2022-11-01 11:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 11:37 [PATCH v4 0/5] nfsd: clean up refcounting in the filecache Jeff Layton
2022-10-31 11:37 ` [PATCH v4 1/5] nfsd: remove the pages_flushed statistic from filecache Jeff Layton
2022-10-31 11:37 ` [PATCH v4 2/5] nfsd: reorganize filecache.c Jeff Layton
2022-10-31 11:37 ` [PATCH v4 3/5] nfsd: rework refcounting in filecache Jeff Layton
2022-10-31 20:45 ` Chuck Lever III
2022-11-01 10:56 ` Jeff Layton
2022-10-31 11:37 ` [PATCH v4 4/5] nfsd: close race between unhashing and LRU addition Jeff Layton
2022-10-31 11:37 ` [PATCH v4 5/5] nfsd: start non-blocking writeback after adding nfsd_file to the LRU Jeff Layton
2022-10-31 21:00 ` Chuck Lever III
2022-11-01 11:13 ` 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=1f12f3c991bb11006571a36f292e7f5239a47b91.camel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox