linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Chuck Lever <cel@kernel.org>, NeilBrown <neil@brown.name>,
	Jeff Layton <jlayton@kernel.org>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
	linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v11 2/3] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE
Date: Mon, 10 Nov 2025 10:42:48 -0500	[thread overview]
Message-ID: <aRIH-ClvzCdoIaqz@kernel.org> (raw)
In-Reply-To: <aRGsgQPe6lktLG2W@infradead.org>

On Mon, Nov 10, 2025 at 01:12:33AM -0800, Christoph Hellwig wrote:
> On Fri, Nov 07, 2025 at 05:16:27PM -0500, Mike Snitzer wrote:
> > Those ends lend themselves to benefitting from more capable RMW
> > if/when needed.
> 
> How are ends of a larger I/O inhently more benefits from cached
> RMW then say a single tiny I/O?

Any unaligned WRITE, no matter the size of the WRITE, will benefit
from RMW of its subpage ends if streaming unaligned WRITEs.

I saw below that even saying "unaligned WRITE" leaves you annoyed.
And time subpage ends are being issued by this code then they are part
of a larger "unaligned WRITE" that was able to be split and have up to
3 segments: unaligned subpage ends and a DIO-aligned middle.

> > All it takes to justify not using DONTCACHE is one
> > workload that benefits (even if suboptimal by nature) given there is
> > no apparent downside (other than requiring we document/comment the
> > behavior).
> 
> Well, the entire reason for this patchset is the downside of cached
> buffered I/O, isn't it?  Now suddently there's no downsides?

Every time I say stuff like "the entire reason for the patchset" I set
myself up for a rebuttal from you.  You just did the same thing.  I'm
going to try to be accomodating and cool but please lets dial back
this weirdly caustic dynamic that is forming yet again.

Why is it that you cannot acknowledge that it isn't an all or nothing
situation?  This isn't hard to see, there is clear benefit from using
cached buffered for the misaligned subpage ends of an unaligned WRITE
that can be split into 3 segemnts.

I provided the benchmark result that shows significant performance
improvement and Chuck pointed it out to you in another thread:
https://lore.kernel.org/linux-nfs/aQrsWnHK1ny3Md9g@kernel.org/

And I do understand Chuck's point of "but do we care about streaming
misaligned WRITE"?  Given the code needs to simply use cached buffered 
IO instead of DONTCACHE for at most 2 individual pages I think it does
make sense to handle it.

Again, its niche but its easily handled and there certainly is benefit
to be had.

Restating an important point underpinning my desire to handle this
niche unaligned streaming WRITE case efficiently: it removes the one
case I know of where NFSD_IO_DIRECT cannot compete with
NFSD_IO_BUFFERED. Whereby making NFSD_IO_DIRECT a compelling
alternative default IO mode.  To leave it to use DONTCACHE would be
purposely compromising NFSD_IO_DIRECT to be less effective.

I'm also saying: there is very limited downside to using cached
buffered for these subpage end segments.  But IF I'm proven wrong and
they do show themselves to be a problem in the future then a code
change will be needed.

> Also to go back to my previous mail:  How can an I/O that is aligned
> in file offset and length, but not in the backing memory ever going
> to benefit from this caching?

It wouldn't, because it would take the no_dio path and the entire IO
would be issued using DONTCACHE.

That I just had to point that out shows how absurd all this contrarian
hand-wringing has gotten.

> > Or is this something we make tunable?
> > NFSD_IO_DIRECT_DONTCACHE_UNALIGNED?
> 
> Throwing in yet another tunable while not understanding the problem
> at hand is about the worst possible outcome.

Just because you don't understand something: that isn't my failing.
So your need to be the expert here is misplaced.  Please show you
understand the problem before you project lack of understanding onto
me.

> > Streaming misaligned WRITEs is the only workload I'm aware of where
> > NFSD_IO_DIRECT can be made noticably worse in comparison to
> > NFSD_IO_BUFFERED (but I haven't done a bucnh of small IO testing).
> > That's a pretty good place for NFSD_IO_DIRECT given the fix is a
> > really straightforward tradeoff decision.
> 
> Can we please stop talking about "misaligned" as a generic thing, when
> there is two very clearly different cases of misalignment.

Sure misaligned/unaligned WRITE is the NFS WTITE operation includes a
payload that is misaligned.  Further categorizaiton is done to
determine of a given WRITE can benefit from being split.

If the WRITE can be split such that the middle is DIO-aligned then it
benefits from using cached buffered for the subpage end segments.

  reply	other threads:[~2025-11-10 15:42 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 15:34 [PATCH v11 0/3] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE Chuck Lever
2025-11-07 15:34 ` [PATCH v11 1/3] NFSD: Make FILE_SYNC WRITEs comply with spec Chuck Lever
2025-11-07 15:34 ` [PATCH v11 2/3] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE Chuck Lever
2025-11-07 15:39   ` Christoph Hellwig
2025-11-07 15:40     ` Chuck Lever
2025-11-07 20:05       ` Mike Snitzer
2025-11-07 20:08         ` Chuck Lever
2025-11-07 20:10           ` Mike Snitzer
2025-11-07 21:58             ` NeilBrown
2025-11-07 22:24               ` Mike Snitzer
2025-11-07 23:42                 ` NeilBrown
2025-11-08  2:01                   ` Mike Snitzer
2025-11-10 16:41                     ` Chuck Lever
2025-11-10 17:57                       ` Mike Snitzer
2025-11-11  8:51                       ` Christoph Hellwig
2025-11-11 14:20                         ` Chuck Lever
2025-11-11 14:21                           ` Christoph Hellwig
2025-11-12  0:06                         ` Mike Snitzer
2025-11-12 15:02                           ` Christoph Hellwig
2025-11-12 23:14                             ` Mike Snitzer
2025-11-13  8:13                               ` Christoph Hellwig
2025-11-13 21:45                                 ` Mike Snitzer
2025-11-07 20:28     ` Chuck Lever
2025-11-07 22:16       ` Mike Snitzer
2025-11-10  9:12         ` Christoph Hellwig
2025-11-10 15:42           ` Mike Snitzer [this message]
2025-11-11  8:44             ` Christoph Hellwig
2025-11-10  9:17       ` Christoph Hellwig
2025-11-10 15:43         ` Mike Snitzer
2025-11-07 17:18   ` Mike Snitzer
2025-11-07 22:13   ` NeilBrown
2025-11-07 15:34 ` [PATCH v11 3/3] NFSD: add Documentation/filesystems/nfs/nfsd-io-modes.rst 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=aRIH-ClvzCdoIaqz@kernel.org \
    --to=snitzer@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=hch@infradead.org \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --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;
as well as URLs for NNTP newsgroup(s).