linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: Anna Schumaker <anna@kernel.org>
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>,
	linux-nfs@vger.kernel.org
Subject: [PATCH v11 0/7] NFS Direct: align misaligned DIO for LOCALIO
Date: Fri, 19 Sep 2025 10:36:24 -0400	[thread overview]
Message-ID: <20250919143631.44851-1-snitzer@kernel.org> (raw)

Hi Anna,

NFS and LOCALIO in particular benefit from avoiding the page cache for
workloads that have a working set that is significantly larger than
available system memory. NFS DIRECT makes it possible to always enable
LOCALIO to use O_DIRECT even if the IO is not DIO-aligned.

This patchset's changes are focused on NFS LOCALIO (fs/nfs/localio.c);
as such they will not impact NFS at all unless CONFIG_NFS_LOCALIO=y

These changes have been tested quite a lot, using workloads from load
generators fio and dt. But also using MLperf benchmark suite's npz
loader library (written in python) that creates a particularly nasty
1MB IO pattern which is DIO-aligned on disk but _not_ in memory (so it
triggers the need to fallback from DIO to buffered IO). I'm happy to
share more specifics on test tools and commandlines if needed.

Changes since v10 (09.17.2025):
- Fixed patch 6's nfstrace.h compiler errors due to #include order in
  nfs2xdr.c
- Rebased patches 2 and 5 to reduce churn/indentation for EINVAL
  error logging.
- Cc Chuck and Jeff for review of patch 2's fs/nfsd/localio.c change
  to add .nfsd_file_dio_alignment callback to nfsd_localio_operations

Changes since v9 (09.15.2025):
- Updated patch 3 to make bvec init while loop similar to
  nfsd_iter_read()
- To support both sync and async completion of DIO (sync completion
  will happen if underlying driver is ramdisk, etc): push DIO's
  nfs_local_pgio_done() down from nfs_local_{read,write}_done to
  nfs_local_{read,write}_aio_complete

Changes since v8 (08.15.2025)
- Removed all fs/nfs/direct.c changes and pushed this misaligned DIO
  handling down to LOCALIO where it belongs.
- Updated all commit headers to reflect changes to code.
- Because misaligned DIO is now handled properly in LOCALIO, removed
  the nfs modparam 'localio_O_DIRECT_semantics' that was added during
  v6.14 to require users opt-in to the requirement that all O_DIRECT
  be properly DIO-aligned.
- Enhanced LOCALIO's DIO WRITE code to handle potential for VFS to
  return -ENOTBLK if it fails to invalidate page cache on WRITE.
- Verified various test IO workloads function as expected; including a
  misaligned DIO test that failed with the previous v8 direct.c
  implementation.
- Verified performance remains high with LOCALIO on fast NVMe.
- Verified sparse and checkpatch.pl are clean.

Earlier changelog was provided in v8's 0th patch header, see:
https://lore.kernel.org/linux-nfs/20250815233003.55071-1-snitzer@kernel.org/

All review appreciated, thanks.
Mike

Mike Snitzer (7):
  nfs/localio: make trace_nfs_local_open_fh more useful
  nfs/localio: avoid issuing misaligned IO using O_DIRECT
  nfs/localio: refactor iocb and iov_iter_bvec initialization
  nfs/localio: refactor iocb initialization
  nfs/localio: add proper O_DIRECT support for READ and WRITE
  nfs/localio: add tracepoints for misaligned DIO READ and WRITE support
  NFS: add basic STATX_DIOALIGN and STATX_DIO_READ_ALIGN support

 fs/nfs/inode.c             |  15 ++
 fs/nfs/internal.h          |  10 +
 fs/nfs/localio.c           | 405 ++++++++++++++++++++++++++++---------
 fs/nfs/nfs2xdr.c           |   2 +-
 fs/nfs/nfs3xdr.c           |   2 +-
 fs/nfs/nfstrace.h          |  76 ++++++-
 fs/nfsd/localio.c          |  11 +
 include/linux/nfslocalio.h |   2 +
 8 files changed, 421 insertions(+), 102 deletions(-)

-- 
2.44.0


             reply	other threads:[~2025-09-19 14:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 14:36 Mike Snitzer [this message]
2025-09-19 14:36 ` [PATCH v11 1/7] nfs/localio: make trace_nfs_local_open_fh more useful Mike Snitzer
2025-09-19 14:36 ` [PATCH v11 2/7] nfs/localio: avoid issuing misaligned IO using O_DIRECT Mike Snitzer
2025-09-19 17:34   ` Jeff Layton
2025-09-20  0:07     ` Mike Snitzer
2025-09-20  1:18     ` [PATCH v11b " Mike Snitzer
2025-09-26 14:15   ` [PATCH v11 " Jeff Layton
2025-09-19 14:36 ` [PATCH v11 3/7] nfs/localio: refactor iocb and iov_iter_bvec initialization Mike Snitzer
2025-09-19 14:36 ` [PATCH v11 4/7] nfs/localio: refactor iocb initialization Mike Snitzer
2025-09-19 14:36 ` [PATCH v11 5/7] nfs/localio: add proper O_DIRECT support for READ and WRITE Mike Snitzer
2025-09-19 14:36 ` [PATCH v11 6/7] nfs/localio: add tracepoints for misaligned DIO READ and WRITE support Mike Snitzer
2025-09-19 14:36 ` [PATCH v11 7/7] NFS: add basic STATX_DIOALIGN and STATX_DIO_READ_ALIGN support Mike Snitzer

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=20250919143631.44851-1-snitzer@kernel.org \
    --to=snitzer@kernel.org \
    --cc=anna@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.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).