Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/panfrost: Introduce huge tmpfs mountpoint option

Introduce the 'panfrost.transparent_hugepage' boolean module parameter
(false by default). When the parameter is set to true, a new tmpfs
mountpoint is created and mounted using the 'huge=within_size'
option. It's then used at GEM object creation instead of the default
'shm_mnt' mountpoint in order to enable Transparent Hugepage (THP) for
the object (without having to rely on a system wide parameter).

v3:
- use huge tmpfs mountpoint in drm_device

v4:
- fix builds with CONFIG_TRANSPARENT_HUGEPAGE=n
- clean up mountpoint creation error handling
- print negative error value

v5:
- use drm_gem_has_huge_tmp() helper
- get rid of CONFIG_TRANSPARENT_HUGEPAGE ifdefs

v9:
- replace drm_gem_has_huge_tmp() by drm_gem_get_huge_tmp()

v11:
- enable 'panfrost.transparent_hugepage' by default

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://patch.msgid.link/20251205182231.194072-10-loic.molinari@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

authored by

Loïc Molinari and committed by
Boris Brezillon
c12e9fcb c569b369

+38
+3
drivers/gpu/drm/panfrost/panfrost_device.c
··· 12 12 #include "panfrost_device.h" 13 13 #include "panfrost_devfreq.h" 14 14 #include "panfrost_features.h" 15 + #include "panfrost_gem.h" 15 16 #include "panfrost_issues.h" 16 17 #include "panfrost_gpu.h" 17 18 #include "panfrost_job.h" ··· 267 266 err = panfrost_perfcnt_init(pfdev); 268 267 if (err) 269 268 goto out_job; 269 + 270 + panfrost_gem_init(pfdev); 270 271 271 272 return 0; 272 273 out_job:
+6
drivers/gpu/drm/panfrost/panfrost_drv.c
··· 858 858 #endif 859 859 }; 860 860 861 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE 862 + bool panfrost_transparent_hugepage = true; 863 + module_param_named(transparent_hugepage, panfrost_transparent_hugepage, bool, 0400); 864 + MODULE_PARM_DESC(transparent_hugepage, "Use a dedicated tmpfs mount point with Transparent Hugepage enabled (true = default)"); 865 + #endif 866 + 861 867 static int panfrost_probe(struct platform_device *pdev) 862 868 { 863 869 struct panfrost_device *pfdev;
+9
drivers/gpu/drm/panfrost/panfrost_drv.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 or MIT */ 2 + /* Copyright 2025 Amazon.com, Inc. or its affiliates */ 3 + 4 + #ifndef __PANFROST_DRV_H__ 5 + #define __PANFROST_DRV_H__ 6 + 7 + extern bool panfrost_transparent_hugepage; 8 + 9 + #endif
+18
drivers/gpu/drm/panfrost/panfrost_gem.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Copyright 2019 Linaro, Ltd, Rob Herring <robh@kernel.org> */ 3 + /* Copyright 2025 Amazon.com, Inc. or its affiliates */ 3 4 4 5 #include <linux/cleanup.h> 5 6 #include <linux/err.h> ··· 11 10 #include <drm/panfrost_drm.h> 12 11 #include <drm/drm_print.h> 13 12 #include "panfrost_device.h" 13 + #include "panfrost_drv.h" 14 14 #include "panfrost_gem.h" 15 15 #include "panfrost_mmu.h" 16 + 17 + void panfrost_gem_init(struct panfrost_device *pfdev) 18 + { 19 + int err; 20 + 21 + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && 22 + !panfrost_transparent_hugepage) 23 + return; 24 + 25 + err = drm_gem_huge_mnt_create(&pfdev->base, "within_size"); 26 + if (drm_gem_get_huge_mnt(&pfdev->base)) 27 + drm_info(&pfdev->base, "Using Transparent Hugepage\n"); 28 + else if (err) 29 + drm_warn(&pfdev->base, "Can't use Transparent Hugepage (%d)\n", 30 + err); 31 + } 16 32 17 33 #ifdef CONFIG_DEBUG_FS 18 34 static void panfrost_gem_debugfs_bo_add(struct panfrost_device *pfdev,
+2
drivers/gpu/drm/panfrost/panfrost_gem.h
··· 124 124 return container_of(node, struct panfrost_gem_mapping, mmnode); 125 125 } 126 126 127 + void panfrost_gem_init(struct panfrost_device *pfdev); 128 + 127 129 struct drm_gem_object *panfrost_gem_create_object(struct drm_device *dev, size_t size); 128 130 129 131 struct drm_gem_object *