[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <489a6590-7d1a-46f9-a980-5c30b2b44c4c@igalia.com>
Date: Tue, 2 Dec 2025 14:19:02 -0300
From: Maíra Canal <mcanal@...lia.com>
To: Loïc Molinari <loic.molinari@...labora.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>, Tvrtko Ursulin
<tursulin@...ulin.net>, Boris Brezillon <boris.brezillon@...labora.com>,
Rob Herring <robh@...nel.org>, Steven Price <steven.price@....com>,
Liviu Dudau <liviu.dudau@....com>, Melissa Wen <mwen@...lia.com>,
Hugh Dickins <hughd@...gle.com>, Baolin Wang
<baolin.wang@...ux.alibaba.com>, Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>, Mikołaj Wasiak
<mikolaj.wasiak@...el.com>, Christian Brauner <brauner@...nel.org>,
Nitin Gote <nitin.r.gote@...el.com>, Andi Shyti
<andi.shyti@...ux.intel.com>, Jonathan Corbet <corbet@....net>,
Christopher Healy <healych@...zon.com>, Matthew Wilcox
<willy@...radead.org>, Bagas Sanjaya <bagasdotme@...il.com>
Cc: linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, linux-mm@...ck.org,
linux-doc@...r.kernel.org, kernel@...labora.com
Subject: Re: [PATCH v11 10/10] Documentation/gpu/drm-mm: Add THP paragraph to
GEM mapping section
Hi Loïc,
On 12/2/25 07:17, Loïc Molinari wrote:
> Add a paragraph to the GEM Objects Creation section about the
> drm_gem_huge_mnt_create() helper and to the GEM objects mapping
> section explaining how transparent huge pages are handled by GEM.
>
> v4:
> - fix wording after huge_pages handler removal
>
> v6:
> - fix wording after map_pages handler removal
>
> v11:
> - mention drm_gem_huge_mnt_create() helper
> - add Boris and Maíra R-bs
>
> Signed-off-by: Loïc Molinari <loic.molinari@...labora.com>
> Reviewed-by: Bagas Sanjaya <bagasdotme@...il.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@...labora.com>
> Reviewed-by: Maíra Canal <mcanal@...lia.com>
Just confirming my R-b:
Reviewed-by: Maíra Canal <mcanal@...lia.com>
Best Regards,
- Maíra
> ---
> Documentation/gpu/drm-mm.rst | 29 +++++++++++++++++++++++------
> 1 file changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/gpu/drm-mm.rst b/Documentation/gpu/drm-mm.rst
> index d55751cad67c..f22433470c76 100644
> --- a/Documentation/gpu/drm-mm.rst
> +++ b/Documentation/gpu/drm-mm.rst
> @@ -155,7 +155,12 @@ drm_gem_object_init() will create an shmfs file of the
> requested size and store it into the struct :c:type:`struct
> drm_gem_object <drm_gem_object>` filp field. The memory is
> used as either main storage for the object when the graphics hardware
> -uses system memory directly or as a backing store otherwise.
> +uses system memory directly or as a backing store otherwise. Drivers
> +can call drm_gem_huge_mnt_create() to create, mount and use a huge
> +shmem mountpoint instead of the default one ('shm_mnt'). For builds
> +with CONFIG_TRANSPARENT_HUGEPAGE enabled, further calls to
> +drm_gem_object_init() will let shmem allocate huge pages when
> +possible.
>
> Drivers are responsible for the actual physical pages allocation by
> calling shmem_read_mapping_page_gfp() for each page.
> @@ -290,15 +295,27 @@ The open and close operations must update the GEM object reference
> count. Drivers can use the drm_gem_vm_open() and drm_gem_vm_close() helper
> functions directly as open and close handlers.
>
> -The fault operation handler is responsible for mapping individual pages
> -to userspace when a page fault occurs. Depending on the memory
> -allocation scheme, drivers can allocate pages at fault time, or can
> -decide to allocate memory for the GEM object at the time the object is
> -created.
> +The fault operation handler is responsible for mapping pages to
> +userspace when a page fault occurs. Depending on the memory allocation
> +scheme, drivers can allocate pages at fault time, or can decide to
> +allocate memory for the GEM object at the time the object is created.
>
> Drivers that want to map the GEM object upfront instead of handling page
> faults can implement their own mmap file operation handler.
>
> +In order to reduce page table overhead, if the internal shmem mountpoint
> +"shm_mnt" is configured to use transparent huge pages (for builds with
> +CONFIG_TRANSPARENT_HUGEPAGE enabled) and if the shmem backing store
> +managed to allocate a huge page for a faulty address, the fault handler
> +will first attempt to insert that huge page into the VMA before falling
> +back to individual page insertion. mmap() user address alignment for GEM
> +objects is handled by providing a custom get_unmapped_area file
> +operation which forwards to the shmem backing store. For most drivers,
> +which don't create a huge mountpoint by default or through a module
> +parameter, transparent huge pages can be enabled by either setting the
> +"transparent_hugepage_shmem" kernel parameter or the
> +"/sys/kernel/mm/transparent_hugepage/shmem_enabled" sysfs knob.
> +
> For platforms without MMU the GEM core provides a helper method
> drm_gem_dma_get_unmapped_area(). The mmap() routines will call this to get a
> proposed address for the mapping.
Powered by blists - more mailing lists