public inbox for [email protected]
 help / color / mirror / Atom feed
* [GIT PULL v2] Improve iomap async dio performance
@ 2023-07-28 13:47 Jens Axboe
  2023-08-01 23:35 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2023-07-28 13:47 UTC (permalink / raw)
  To: Darrick J . Wong; +Cc: [email protected], io-uring, Dave Chinner

Hi,

Here's the pull request for improving async dio performance with
iomap. Contains a few generic cleanups as well, but the meat of it
is described in the tagged commit message below.

Please pull for 6.6!


The following changes since commit ccff6d117d8dc8d8d86e8695a75e5f8b01e573bf:

  Merge tag 'perf-tools-fixes-for-v6.5-1-2023-07-18' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools (2023-07-18 14:51:29 -0700)

are available in the Git repository at:

  git://git.kernel.dk/linux.git tags/xfs-async-dio.6-2023-07-28

for you to fetch changes up to 634aae6c33338308f92eb137b0ea4833457c2ce7:

  iomap: support IOCB_DIO_CALLER_COMP (2023-07-25 07:47:20 -0600)

----------------------------------------------------------------
Improve iomap/xfs async dio write performance

iomap always punts async dio write completions to a workqueue, which has
a cost in terms of efficiency (now you need an unrelated worker to
process it) and latency (now you're bouncing a completion through an
async worker, which is a classic slowdown scenario).

io_uring handles IRQ completions via task_work, and for writes that
don't need to do extra IO at completion time, we can safely complete
them inline from that. This patchset adds IOCB_DIO_CALLER_COMP, which an
IO issuer can set to inform the completion side that any extra work that
needs doing for that completion can be punted to a safe task context.

The iomap dio completion will happen in hard/soft irq context, and we
need a saner context to process these completions. IOCB_DIO_CALLER_COMP
is added, which can be set in a struct kiocb->ki_flags by the issuer. If
the completion side of the iocb handling understands this flag, it can
choose to set a kiocb->dio_complete() handler and just call ki_complete
from IRQ context. The issuer must then ensure that this callback is
processed from a task. io_uring punts IRQ completions to task_work
already, so it's trivial wire it up to run more of the completion before
posting a CQE. This is good for up to a 37% improvement in
throughput/latency for low queue depth IO, patch 5 has the details.

If we need to do real work at completion time, iomap will clear the
IOMAP_DIO_CALLER_COMP flag.

This work came about when Andres tested low queue depth dio writes for
postgres and compared it to doing sync dio writes, showing that the
async processing slows us down a lot.

----------------------------------------------------------------
Jens Axboe (8):
      iomap: cleanup up iomap_dio_bio_end_io()
      iomap: use an unsigned type for IOMAP_DIO_* defines
      iomap: treat a write through cache the same as FUA
      iomap: only set iocb->private for polled bio
      iomap: add IOMAP_DIO_INLINE_COMP
      fs: add IOCB flags related to passing back dio completions
      io_uring/rw: add write support for IOCB_DIO_CALLER_COMP
      iomap: support IOCB_DIO_CALLER_COMP

 fs/iomap/direct-io.c | 163 ++++++++++++++++++++++++++++++++++++++-------------
 include/linux/fs.h   |  35 ++++++++++-
 io_uring/rw.c        |  27 ++++++++-
 3 files changed, 180 insertions(+), 45 deletions(-)

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-01 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28 13:47 [GIT PULL v2] Improve iomap async dio performance Jens Axboe
2023-08-01 23:35 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox