[PATCH 0/8] drm: Optimize page tables overhead with THP
From: Loïc Molinari
Date: Mon Sep 29 2025 - 16:04:35 EST
This series aims to reduce the page tables overhead of DRM drivers for
builds with CONFIG_TRANSPARENT_HUGEPAGE enabled and either the sysfs
config '/sys/kernel/mm/transparent_hugepage/shmem_enabled'
appropriately set or drivers using a dedicated huge tmpfs mount point.
It starts by adding a huge page fault handler for GEM objects to
insert PMD or PUD mappings whenever the shmem backing store manages to
create huge folios. It then introduces a dedicated get_unmapped_area
file operation on the DRM file descriptor for GEM objects to get the
best virtual address alignment for the underlying shmem buffers.
The remaining commits propose shmem helpers to create and release huge
tmpfs mount points and adapt the i915 and V3D drivers. The helpers are
then used to optionally enable Transparent Hugepage for Panfrost and
Panthor.
Loïc Molinari (8):
drm/shmem-helper: Add huge page fault handler
drm/gem: Introduce drm_gem_get_unmapped_area() fop
drm/shmem-helper: Add huge tmpfs mount point helpers
drm/i915: Use huge tmpfs mount point helpers
drm/v3d: Use huge tmpfs mount point helpers
drm/panthor: Introduce huge tmpfs mount point option
drm/panthor: Improve IOMMU map/unmap debugging logs
drm/panfrost: Introduce huge tmpfs mount point option
drivers/gpu/drm/drm_gem.c | 110 ++++++++++++++++----
drivers/gpu/drm/drm_gem_shmem_helper.c | 112 ++++++++++++++++++++-
drivers/gpu/drm/i915/gem/i915_gemfs.c | 33 +-----
drivers/gpu/drm/panfrost/panfrost_device.c | 4 +
drivers/gpu/drm/panfrost/panfrost_device.h | 2 +
drivers/gpu/drm/panfrost/panfrost_drv.c | 6 ++
drivers/gpu/drm/panfrost/panfrost_drv.h | 11 ++
drivers/gpu/drm/panfrost/panfrost_gem.c | 29 +++++-
drivers/gpu/drm/panfrost/panfrost_gem.h | 3 +
drivers/gpu/drm/panthor/panthor_device.c | 4 +
drivers/gpu/drm/panthor/panthor_device.h | 3 +
drivers/gpu/drm/panthor/panthor_drv.c | 7 ++
drivers/gpu/drm/panthor/panthor_drv.h | 11 ++
drivers/gpu/drm/panthor/panthor_gem.c | 30 +++++-
drivers/gpu/drm/panthor/panthor_gem.h | 3 +
drivers/gpu/drm/panthor/panthor_mmu.c | 19 +++-
drivers/gpu/drm/v3d/v3d_gemfs.c | 31 +-----
include/drm/drm_gem.h | 4 +
include/drm/drm_gem_shmem_helper.h | 14 +++
mm/shmem.c | 1 +
20 files changed, 346 insertions(+), 91 deletions(-)
create mode 100644 drivers/gpu/drm/panfrost/panfrost_drv.h
create mode 100644 drivers/gpu/drm/panthor/panthor_drv.h
--
2.47.3