[PATCH v6 0/5] Enable THP support in drm_pagemap

Francois Dugast francois.dugast at intel.com
Fri Jan 16 22:10:15 AEDT 2026


Use Balbir Singh's series for device-private THP support [1] and previous
preparation work in drm_pagemap [2] to add 2MB/THP support in xe. This leads
to significant performance improvements when using SVM with 2MB pages.

[1] https://lore.kernel.org/linux-mm/20251001065707.920170-1-balbirs@nvidia.com/
[2] https://patchwork.freedesktop.org/series/151754/

v2:
- rebase on top of multi-device SVM
- add drm_pagemap_cpages() with temporary patch
- address other feedback from Matt Brost on v1

v3:
The major change is to remove the dependency to the mm/huge_memory
helper migrate_device_split_page() that was called explicitely when
a 2M buddy allocation backed by a large folio would be later reused
for a smaller allocation (4K or 64K). Instead, the first 3 patches
provided by Matthew Brost ensure large folios are split at the time
of freeing.

v4:
- add order argument to folio_free callback
- send complete series to linux-mm and MM folks as requested (Zi Yan
  and Andrew Morton) and cover letter to anyone receiving at least
  one of the patches (Liam R. Howlett)

v5:
- update zone_device_page_init() in patch #1 to reinitialize large
  zone device private folios

v6:
- fix drm_pagemap change in patch #1 to allow applying to 6.19 and
  add some comments

Cc: Zi Yan <ziy at nvidia.com>
Cc: Madhavan Srinivasan <maddy at linux.ibm.com>
Cc: Alistair Popple <apopple at nvidia.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes at oracle.com>
Cc: Liam R. Howlett <Liam.Howlett at oracle.com>
Cc: Suren Baghdasaryan <surenb at google.com>
Cc: Michal Hocko <mhocko at suse.com>
Cc: Mike Rapoport <rppt at kernel.org>
Cc: Vlastimil Babka <vbabka at suse.cz>
Cc: Nicholas Piggin <npiggin at gmail.com>
Cc: Michael Ellerman <mpe at ellerman.id.au>
Cc: "Christophe Leroy (CS GROUP)" <chleroy at kernel.org>
Cc: Felix Kuehling <Felix.Kuehling at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: "Christian König" <christian.koenig at amd.com>
Cc: David Airlie <airlied at gmail.com>
Cc: Simona Vetter <simona at ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Maxime Ripard <mripard at kernel.org>
Cc: Thomas Zimmermann <tzimmermann at suse.de>
Cc: Lyude Paul <lyude at redhat.com>
Cc: Danilo Krummrich <dakr at kernel.org>
Cc: Bjorn Helgaas <bhelgaas at google.com>
Cc: Logan Gunthorpe <logang at deltatee.com>
Cc: David Hildenbrand <david at kernel.org>
Cc: Oscar Salvador <osalvador at suse.de>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Jason Gunthorpe <jgg at ziepe.ca>
Cc: Leon Romanovsky <leon at kernel.org>
Cc: Balbir Singh <balbirs at nvidia.com>
Cc: Dan Williams <dan.j.williams at intel.com>
Cc: Matthew Wilcox <willy at infradead.org>
Cc: Jan Kara <jack at suse.cz>
Cc: Alexander Viro <viro at zeniv.linux.org.uk>
Cc: Christian Brauner <brauner at kernel.org>
Cc: Mika Penttilä <mpenttil at redhat.com>
Cc: linuxppc-dev at lists.ozlabs.org
Cc: kvm at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: amd-gfx at lists.freedesktop.org
Cc: dri-devel at lists.freedesktop.org
Cc: nouveau at lists.freedesktop.org
Cc: linux-pci at vger.kernel.org
Cc: linux-mm at kvack.org
Cc: linux-cxl at vger.kernel.org
Cc: nvdimm at lists.linux.dev
Cc: linux-fsdevel at vger.kernel.org

Francois Dugast (3):
  drm/pagemap: Unlock and put folios when possible
  drm/pagemap: Add helper to access zone_device_data
  drm/pagemap: Enable THP support for GPU memory migration

Matthew Brost (2):
  mm/zone_device: Reinitialize large zone device private folios
  drm/pagemap: Correct cpages calculation for migrate_vma_setup

 arch/powerpc/kvm/book3s_hv_uvmem.c       |   2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c |   2 +-
 drivers/gpu/drm/drm_gpusvm.c             |   7 +-
 drivers/gpu/drm/drm_pagemap.c            | 158 ++++++++++++++++++-----
 drivers/gpu/drm/nouveau/nouveau_dmem.c   |   2 +-
 include/drm/drm_pagemap.h                |  15 +++
 include/linux/memremap.h                 |   9 +-
 lib/test_hmm.c                           |   4 +-
 mm/memremap.c                            |  35 ++++-
 9 files changed, 195 insertions(+), 39 deletions(-)

-- 
2.43.0



More information about the Linuxppc-dev mailing list