From: Mike Snitzer <snitzer@kernel.org>
To: Chuck Lever <cel@kernel.org>
Cc: Christoph Hellwig <hch@infradead.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, Christoph Hellwig <hch@lst.de>,
Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v8 09/12] NFSD: Handle both offset and memory alignment for direct I/O
Date: Fri, 31 Oct 2025 12:07:37 -0400 [thread overview]
Message-ID: <aQTeyczWFoERHlpf@kernel.org> (raw)
In-Reply-To: <88535f7a-abc7-4649-a2b4-ba520e9aae0b@kernel.org>
On Fri, Oct 31, 2025 at 09:21:27AM -0400, Chuck Lever wrote:
> On 10/31/25 9:19 AM, Christoph Hellwig wrote:
> > On Mon, Oct 27, 2025 at 11:46:27AM -0400, Chuck Lever wrote:
> >> From: Chuck Lever <chuck.lever@oracle.com>
> >>
> >> Currently, nfsd_is_write_dio_possible() only considers file offset
> >> alignment (nf_dio_offset_align) when splitting an NFS WRITE request
> >> into segments. This leaves accounting for memory buffer alignment
> >> (nf_dio_mem_align) until nfsd_setup_write_dio_iters(). If this
> >> second check fails, the code falls back to cached I/O entirely,
> >> wasting the opportunity to use direct I/O for the bulk of the
> >> request.
> >>
> >> Enhance the logic to find a beginning segment size that satisfies
> >> both alignment constraints simultaneously. The search algorithm
> >> starts with the file offset alignment requirement and steps through
> >> multiples of offset_align, checking memory alignment at each step.
> >> The search is bounded by lcm(offset_align, mem_align) to ensure that
> >> it always terminates.
> >
> > How likely is that going to happen? After the first bvec the
> > alignment constrains won't change, so how are we going to succeed
> > then?
> >
>
> I was hoping that this algorithm would improve the likelihood of
> finding a middle segment alignment for NFS WRITE on TCP. I'm not
> entirely sure it has been effective.
>
> Given the complexity, I'm wondering if I want to keep this one.
I don't think its worth the complexity. And I don't see how it'd help
make TCP's potentially unaligned buffer, for the NFS WRITE's payload,
able to work within the required ondisk logical offset granularity.
The mlperf_npz_tool.py I provided does a really good job of exposing
this worse case scenario, especially when the NFS client is forced to
use DIO (but even if just using buffered IO it has some issue just
that the NFS client's use of the page cache causes the IO that's sent
over the wire to NFSD to be much larger, so its head and tail of that
large IO are misaligned). But when the NFS client does use O_DIRECT
each and every 1MB IO is offset in memory such that every single
logical_block_size isn't aligned relative to associated page -- each
spans multiple pages.
next prev parent reply other threads:[~2025-10-31 16:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 15:46 [PATCH v8 00/12] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE Chuck Lever
2025-10-27 15:46 ` [PATCH v8 01/12] NFSD: Make FILE_SYNC WRITEs comply with spec Chuck Lever
2025-10-27 15:46 ` [PATCH v8 02/12] NFSD: Enable return of an updated stable_how to NFS clients Chuck Lever
2025-10-27 15:46 ` [PATCH v8 03/12] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE Chuck Lever
2025-10-27 15:46 ` [PATCH v8 04/12] NFSD: Remove specific error handling Chuck Lever
2025-10-27 15:46 ` [PATCH v8 05/12] NFSD: Remove alignment size checking Chuck Lever
2025-10-27 15:46 ` [PATCH v8 06/12] NFSD: Clean up struct nfsd_write_dio Chuck Lever
2025-10-27 15:46 ` [PATCH v8 07/12] NFSD: Introduce struct nfsd_write_dio_seg Chuck Lever
2025-10-27 15:46 ` [PATCH v8 08/12] NFSD: Simplify nfsd_iov_iter_aligned_bvec() Chuck Lever
2025-10-30 15:00 ` Jeff Layton
2025-10-31 13:16 ` Christoph Hellwig
2025-10-27 15:46 ` [PATCH v8 09/12] NFSD: Handle both offset and memory alignment for direct I/O Chuck Lever
2025-10-30 19:52 ` Jeff Layton
2025-10-30 19:55 ` Chuck Lever
2025-10-31 9:13 ` Christoph Hellwig
2025-10-31 13:19 ` Christoph Hellwig
2025-10-31 13:21 ` Chuck Lever
2025-10-31 13:23 ` Christoph Hellwig
2025-10-31 16:07 ` Mike Snitzer [this message]
2025-10-27 15:46 ` [PATCH v8 10/12] NFSD: Combine direct I/O feasibility check with iterator setup Chuck Lever
2025-10-30 19:59 ` Jeff Layton
2025-10-31 13:20 ` Christoph Hellwig
2025-10-27 15:46 ` [PATCH v8 11/12] NFSD: Handle kiocb->ki_flags correctly Chuck Lever
2025-10-30 20:01 ` Jeff Layton
2025-10-31 13:21 ` Christoph Hellwig
2025-10-27 15:46 ` [PATCH v8 12/12] NFSD: Refactor nfsd_vfs_write Chuck Lever
2025-10-30 20:02 ` Jeff Layton
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=aQTeyczWFoERHlpf@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=hch@lst.de \
--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