mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] udmabuf: speed up mmap() of huge page backed buffers
@ 2026-11-22  7:37 Qiliang Yuan
  2026-11-22  7:37 ` [PATCH 1/3] dma-buf: align large mappings to PMD boundaries Qiliang Yuan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qiliang Yuan @ 2026-11-22  7:37 UTC (permalink / raw)
  To: Sumit Semwal, Christian König, Philipp Stanner,
	Gerd Hoffmann, Vivek Kasireddy, Shuah Khan
  Cc: linux-media, dri-devel, linaro-mm-sig, linux-kernel,
	linux-kselftest, Qiliang Yuan

QEMU and crosvm export virtio-gpu blob resources from guest memory as
udmabufs, which the host renderer and display mmap(). The guest memory is
often backed by 2 MiB huge pages, yet udmabuf maps it 4 KiB at a time:
mapping and touching a 4 GiB buffer inserts a million PTEs and takes over
200 ms.

Patch 1 has mmap() of a dma-buf align large mappings to PMD boundaries,
which any exporter mapping contiguous memory with PMDs needs, such as the
proposed VFIO dma-buf mmap() [1]. Patch 2 maps the huge page backed
ranges of a udmabuf with PMDs, which cuts the time to map and touch it
by 87-90% for hugetlb and shmem THP backed buffers and leaves 4 KiB
backed ones as they are. Patch 3 adds selftests.

[1] https://lore.kernel.org/r/20260527102319.100128-1-mattev@meta.com

Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>
---
Qiliang Yuan (3):
      dma-buf: align large mappings to PMD boundaries
      udmabuf: map huge page backed ranges with PMDs
      selftests/udmabuf: test mapping a huge page backed udmabuf

 drivers/dma-buf/dma-buf.c                         |  1 +
 drivers/dma-buf/udmabuf.c                         | 69 ++++++++++++++++-
 tools/testing/selftests/drivers/dma-buf/udmabuf.c | 90 ++++++++++++++++++++++-
 3 files changed, 158 insertions(+), 2 deletions(-)
---
base-commit: c408466a4dfaee4b12587e926c5b85e68c8b3c40
change-id: 20261121-feat-udmabuf-huge-pfnmap-3258272d077e

Best regards,
-- 
Qiliang Yuan <qiliang.yuan@linux.dev>


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

end of thread, other threads:[~2026-11-22  7:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-22  7:37 [PATCH 0/3] udmabuf: speed up mmap() of huge page backed buffers Qiliang Yuan
2026-11-22  7:37 ` [PATCH 1/3] dma-buf: align large mappings to PMD boundaries Qiliang Yuan
2026-11-22  7:37 ` [PATCH 2/3] udmabuf: map huge page backed ranges with PMDs Qiliang Yuan
2026-11-22  7:37 ` [PATCH 3/3] selftests/udmabuf: test mapping a huge page backed udmabuf Qiliang Yuan

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

all inboxes | Powered by JetHome®