From: Andres Freund <andres@anarazel.de>
To: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, linux-block@vger.kernel.org,
Muchun Song <muchun.song@linux.dev>,
Jane Chu <jane.chu@oracle.com>, Jens Axboe <axboe@kernel.dk>
Subject: Re: Direct I/O performance problems with 1GB pages
Date: Mon, 27 Jan 2025 13:21:24 -0500 [thread overview]
Message-ID: <6ulkhmnl4rot5vrywoxvoewko7vbgkhypcwxjccghdu26kwsx5@bnseuzrsedte> (raw)
In-Reply-To: <f3710cc4-cbbf-4f1e-93a0-9eb6697df2d3@redhat.com>
Hi,
On 2025-01-27 17:09:57 +0100, David Hildenbrand wrote:
> > Andres shared some gists, but I don't want to send those to a
> > mailing list without permission. Here's the kernel part of the
> > perf report:
> >
> > 14.04% postgres [kernel.kallsyms] [k] try_grab_folio_fast
> > |
> > --14.04%--try_grab_folio_fast
> > gup_fast_fallback
> > |
> > --13.85%--iov_iter_extract_pages
> > bio_iov_iter_get_pages
> > iomap_dio_bio_iter
> > __iomap_dio_rw
> > iomap_dio_rw
> > xfs_file_dio_read
> > xfs_file_read_iter
> > __io_read
> > io_read
> > io_issue_sqe
> > io_submit_sqes
> > __do_sys_io_uring_enter
> > do_syscall_64
> >
> > Now, since postgres is using io_uring, perhaps there could be a path
> > which registers the memory with the iouring (doing the refcount/pincount
> > dance once), and then use that pinned memory for each I/O. Maybe that
> > already exists; I'm not keeping up with io_uring development and I can't
> > seem to find any documentation on what things like io_provide_buffers()
> > actually do.
Worth noting that we'll not always use io_uring. Partially for portability to
other platforms, partially because it turns out that io_uring is disabled in
enough environments that we can't rely on it. The generic fallback
implementation is a pool of worker processes connected via shared memory. The
worker process approach did run into this issue, fwiw.
That's not to say that a legit answer to this scalability issue can't be "use
fixed bufs with io_uring", just wanted to give context.
> That's precisely what io-uring fixed buffers do :)
I looked at using them at some point - unfortunately it seems that there is
just {READ,WRITE}_FIXED not {READV,WRITEV}_FIXED. It's *exceedingly* common
for us to do reads/writes where source/target buffers aren't wholly
contiguous. Thus - unless I am misunderstanding something, entirely plausible
- using fixed buffers would unfortunately increase the number of IOs
noticeably.
Should have sent an email about that...
I guess we could add some heuristic to use _FIXED if it doesn't require
splitting an IO into too many sub-ios. But that seems pretty gnarly.
I dimly recall that I also ran into some around using fixed buffers as a
non-root user. It might just be the accounting of registered buffers as
mlocked memory and the difficulty of configuring that across
distributions. But I unfortunately don't remember any details anymore.
Greetings,
Andres Freund
next prev parent reply other threads:[~2025-01-27 18:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-26 0:46 Matthew Wilcox
2025-01-27 14:09 ` David Hildenbrand
2025-01-27 16:02 ` Matthew Wilcox
2025-01-27 16:09 ` David Hildenbrand
2025-01-27 16:20 ` David Hildenbrand
2025-01-27 16:56 ` Matthew Wilcox
2025-01-27 16:59 ` David Hildenbrand
2025-01-27 18:21 ` Andres Freund [this message]
2025-01-27 18:54 ` Jens Axboe
2025-01-27 19:07 ` David Hildenbrand
2025-01-27 21:32 ` Pavel Begunkov
2025-01-27 16:24 ` Keith Busch
2025-01-27 17:25 ` Andres Freund
2025-01-27 19:20 ` David Hildenbrand
2025-01-27 19:36 ` Andres Freund
2025-01-28 5:56 ` Christoph Hellwig
2025-01-28 9:47 ` David Hildenbrand
2025-01-29 6:03 ` Christoph Hellwig
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=6ulkhmnl4rot5vrywoxvoewko7vbgkhypcwxjccghdu26kwsx5@bnseuzrsedte \
--to=andres@anarazel.de \
--cc=axboe@kernel.dk \
--cc=david@redhat.com \
--cc=jane.chu@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=willy@infradead.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