From: wangtao <tao.wangtao@honor.com>
To: "Christoph Hellwig" <hch@infradead.org>,
"Christian König" <christian.koenig@amd.com>
Cc: "sumit.semwal@linaro.org" <sumit.semwal@linaro.org>,
"kraxel@redhat.com" <kraxel@redhat.com>,
"vivek.kasireddy@intel.com" <vivek.kasireddy@intel.com>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"brauner@kernel.org" <brauner@kernel.org>,
"hughd@google.com" <hughd@google.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"amir73il@gmail.com" <amir73il@gmail.com>,
"benjamin.gaignard@collabora.com"
<benjamin.gaignard@collabora.com>,
"Brian.Starkey@arm.com" <Brian.Starkey@arm.com>,
"jstultz@google.com" <jstultz@google.com>,
"tjmercier@google.com" <tjmercier@google.com>,
"jack@suse.cz" <jack@suse.cz>,
"baolin.wang@linux.alibaba.com" <baolin.wang@linux.alibaba.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"wangbintian(BintianWang)" <bintian.wang@honor.com>,
yipengxiang <yipengxiang@honor.com>,
liulu 00013167 <liulu.liu@honor.com>,
hanfeng 00012985 <feng.han@honor.com>
Subject: RE: [PATCH v4 0/4] Implement dmabuf direct I/O via copy_file_range
Date: Fri, 13 Jun 2025 09:43:08 +0000 [thread overview]
Message-ID: <80ce3ec9104c4f0abbcb589b03a5f3c7@honor.com> (raw)
In-Reply-To: <aEg1BZj-HzbgWKsx@infradead.org>
> On Tue, Jun 10, 2025 at 12:52:18PM +0200, Christian König wrote:
> > >> dma_addr_t/len array now that the new DMA API supporting that has
> > >> been merged. Is there any chance the dma-buf maintainers could
> > >> start to kick this off? I'm of course happy to assist.
> >
> > Work on that is already underway for some time.
> >
> > Most GPU drivers already do sg_table -> DMA array conversion, I need
> > to push on the remaining to clean up.
>
> Do you have a pointer?
>
> > >> Yes, that's really puzzling and should be addressed first.
> > > With high CPU performance (e.g., 3GHz), GUP (get_user_pages)
> > > overhead is relatively low (observed in 3GHz tests).
> >
> > Even on a low end CPU walking the page tables and grabbing references
> > shouldn't be that much of an overhead.
>
> Yes.
>
> >
> > There must be some reason why you see so much CPU overhead. E.g.
> > compound pages are broken up or similar which should not happen in the
> > first place.
>
> pin_user_pages outputs an array of PAGE_SIZE (modulo offset and shorter
> last length) array strut pages unfortunately. The block direct I/O code has
> grown code to reassemble folios from them fairly recently which did speed
> up some workloads.
>
> Is this test using the block device or iomap direct I/O code? What kernel
> version is it run on?
Here's my analysis on Linux 6.6 with F2FS/iomap.
Comparing udmabuf+memfd direct read vs dmabuf direct c_f_r:
Systrace: On a high-end 3 GHz CPU, the former occupies >80% runtime vs
<20% for the latter. On a low-end 1 GHz CPU, the former becomes CPU-bound.
Perf: For the former, bio_iov_iter_get_pages/get_user_pages dominate
latency. The latter avoids this via lightweight bvec assignments.
|- 13.03% __arm64_sys_read
|-|- 13.03% f2fs_file_read_iter
|-|-|- 13.03% __iomap_dio_rw
|-|-|-|- 12.95% iomap_dio_bio_iter
|-|-|-|-|- 10.69% bio_iov_iter_get_pages
|-|-|-|-|-|- 10.53% iov_iter_extract_pages
|-|-|-|-|-|-|- 10.53% pin_user_pages_fast
|-|-|-|-|-|-|-|- 10.53% internal_get_user_pages_fast
|-|-|-|-|-|-|-|-|- 10.23% __gup_longterm_locked
|-|-|-|-|-|-|-|-|-|- 8.85% __get_user_pages
|-|-|-|-|-|-|-|-|-|-|- 6.26% handle_mm_fault
|-|-|-|-|- 1.91% iomap_dio_submit_bio
|-|-|-|-|-|- 1.64% submit_bio
|- 1.13% __arm64_sys_copy_file_range
|-|- 1.13% vfs_copy_file_range
|-|-|- 1.13% dma_buf_copy_file_range
|-|-|-|- 1.13% system_heap_dma_buf_rw_file
|-|-|-|-|- 1.13% f2fs_file_read_iter
|-|-|-|-|-|- 1.13% __iomap_dio_rw
|-|-|-|-|-|-|- 1.13% iomap_dio_bio_iter
|-|-|-|-|-|-|-|- 1.13% iomap_dio_submit_bio
|-|-|-|-|-|-|-|-|- 1.08% submit_bio
Large folios can reduce GUP overhead but still significantly slower
than dmabuf to bio_vec conversion.
Regards,
Wangtao.
next prev parent reply other threads:[~2025-06-13 9:44 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 9:52 [PATCH v4 0/4] Implement dmabuf direct I/O via copy_file_range wangtao
2025-06-03 9:52 ` [PATCH v4 1/4] fs: allow cross-FS copy_file_range for memory file with direct I/O wangtao
2025-06-03 10:56 ` Amir Goldstein
2025-06-03 12:38 ` wangtao
2025-06-03 12:43 ` Amir Goldstein
2025-06-03 9:52 ` [PATCH v4 2/4] dmabuf: Implement copy_file_range callback for dmabuf direct I/O prep wangtao
2025-06-03 10:42 ` Christian König
2025-06-03 12:26 ` wangtao
2025-06-03 13:04 ` Christoph Hellwig
2025-06-03 9:52 ` [PATCH v4 3/4] udmabuf: Implement udmabuf direct I/O wangtao
2025-06-03 9:52 ` [PATCH v4 4/4] dmabuf:system_heap Implement system_heap dmabuf " wangtao
2025-06-03 13:00 ` [PATCH v4 0/4] Implement dmabuf direct I/O via copy_file_range Christoph Hellwig
2025-06-03 13:14 ` Christian König
2025-06-03 13:19 ` Christoph Hellwig
2025-06-03 14:18 ` Christian König
2025-06-03 14:28 ` Christoph Hellwig
2025-06-03 15:55 ` Christian König
2025-06-03 16:01 ` Christoph Hellwig
2025-06-06 9:59 ` wangtao
2025-06-06 9:52 ` wangtao
2025-06-06 11:20 ` Christian König
2025-06-09 4:35 ` Christoph Hellwig
2025-06-09 9:32 ` wangtao
2025-06-10 10:52 ` Christian König
2025-06-10 13:37 ` Christoph Hellwig
2025-06-13 9:43 ` wangtao [this message]
2025-06-16 5:24 ` Christoph Hellwig
2025-06-10 13:34 ` Christoph Hellwig
2025-06-13 9:33 ` wangtao
2025-06-16 5:25 ` 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=80ce3ec9104c4f0abbcb589b03a5f3c7@honor.com \
--to=tao.wangtao@honor.com \
--cc=Brian.Starkey@arm.com \
--cc=akpm@linux-foundation.org \
--cc=amir73il@gmail.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=benjamin.gaignard@collabora.com \
--cc=bintian.wang@honor.com \
--cc=brauner@kernel.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=feng.han@honor.com \
--cc=hch@infradead.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=jstultz@google.com \
--cc=kraxel@redhat.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liulu.liu@honor.com \
--cc=sumit.semwal@linaro.org \
--cc=tjmercier@google.com \
--cc=viro@zeniv.linux.org.uk \
--cc=vivek.kasireddy@intel.com \
--cc=yipengxiang@honor.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.