From: Ameer Hamza <ameer.hamza@truenas.com>
To: NeilBrown <neil@brown.name>
Cc: cel@kernel.org, jlayton@kernel.org, okorniev@redhat.com,
Dai.Ngo@oracle.com, tom@talpey.com, trondmy@kernel.org,
anna@kernel.org, linux-nfs@vger.kernel.org,
linux-kernel@vger.kernel.org, alexander.motin@truenas.com,
caleb.stjohn@truenas.com
Subject: Re: [PATCH 1/2] NFSD: Use nfsd_iter_read() when ->splice_read is not zero-copy
Date: Wed, 19 Aug 2026 04:22:06 +0500 [thread overview]
Message-ID: <aoToQWzqZNqB4sIJ@hamza-PC> (raw)
In-Reply-To: <178709365192.2852630.5607658976022815566@noble.neil.brown.name>
On Wed, Aug 19, 2026 at 08:54:11AM +1000, NeilBrown wrote:
> On Tue, 18 Aug 2026, Ameer Hamza wrote:
> > For some files splicing a READ cannot avoid a copy: gfs2, kernfs
> > and the cifs direct-I/O modes use copy_splice_read() as their
> > ->splice_read, and the VFS substitutes it for DAX files.
> > copy_splice_read() allocates a fresh page for every page of
> > payload and reads into it; nfsd_splice_actor() then installs
> > those pages in rq_respages, displacing Reply pages the thread
> > already owns. Both sets of pages are then freed.
> >
> > Route these READs through nfsd_iter_read() instead. It performs
> > the same single copy, but into the thread's own Reply pages, so
> > the per-READ allocation and the displacement both disappear. On
> > its own this is not expected to raise throughput; it changes
> > which pages a Reply is built from so that the next patch can
> > recycle them.
> >
> > 9p and ceph fall back to copy_splice_read() only inside their
> > own ->splice_read methods, which nfsd_splice_read_is_zero_copy()
> > cannot detect,
>
> I think that if we are going to do this then we should do it properly
> and make it easy to detect these cases.
>
> Could we add an FMODE flags FMODE_DONT_COPY_FOR_SPLICE which causes
> copy_splice_read() to return -ENOTSUP or similar.
> Then nfsd can call splice_read if it appear to exist, but set that flag.
> If it fails with -ENOTSUP, fall back to iter_read.
>
> I really don't like the approach of explicitly testing whether
> f_op->splice_read is a particular value.
Thanks, this indeed works better. I believe it also covers 9p and
ceph falling back to copy_splice_read() internally, which the
helper could not see. I will work it out this way for v2.
next prev parent reply other threads:[~2026-08-18 23:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 21:08 [PATCH 0/2] SUNRPC: Recycle sent Reply pages instead of freeing them Ameer Hamza
2026-08-17 21:08 ` [PATCH 1/2] NFSD: Use nfsd_iter_read() when ->splice_read is not zero-copy Ameer Hamza
2026-08-18 13:55 ` Chuck Lever
2026-08-18 23:12 ` Ameer Hamza
2026-08-18 14:42 ` Christoph Hellwig
2026-08-18 23:44 ` Ameer Hamza
2026-08-18 22:54 ` NeilBrown
2026-08-18 23:22 ` Ameer Hamza [this message]
2026-08-19 5:59 ` Christoph Hellwig
2026-08-17 21:08 ` [PATCH 2/2] SUNRPC: Recycle sent Reply pages instead of freeing them Ameer Hamza
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=aoToQWzqZNqB4sIJ@hamza-PC \
--to=ameer.hamza@truenas.com \
--cc=Dai.Ngo@oracle.com \
--cc=alexander.motin@truenas.com \
--cc=anna@kernel.org \
--cc=caleb.stjohn@truenas.com \
--cc=cel@kernel.org \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
--cc=trondmy@kernel.org \
/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
all inboxes | Powered by JetHome®