[PATCH 4/8] drm/i915: Use huge tmpfs mount point helpers

From: Loïc Molinari

Date: Mon Sep 29 2025 - 16:04:46 EST


Make use of the new drm_gem_shmem_huge_mnt_create() and
drm_gem_shmem_huge_mnt_free() helpers to avoid code duplication.

Signed-off-by: Loïc Molinari <loic.molinari@xxxxxxxxxxxxx>
---
drivers/gpu/drm/i915/gem/i915_gemfs.c | 33 +++------------------------
1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gemfs.c b/drivers/gpu/drm/i915/gem/i915_gemfs.c
index a09e2eb47175..70563a6a0b81 100644
--- a/drivers/gpu/drm/i915/gem/i915_gemfs.c
+++ b/drivers/gpu/drm/i915/gem/i915_gemfs.c
@@ -3,25 +3,13 @@
* Copyright © 2017 Intel Corporation
*/

-#include <linux/fs.h>
-#include <linux/mount.h>
-#include <linux/fs_context.h>
-
#include "i915_drv.h"
#include "i915_gemfs.h"
#include "i915_utils.h"

-static int add_param(struct fs_context *fc, const char *key, const char *val)
-{
- return vfs_parse_fs_string(fc, key, val, strlen(val));
-}
-
void i915_gemfs_init(struct drm_i915_private *i915)
{
- struct file_system_type *type;
- struct fs_context *fc;
struct vfsmount *gemfs;
- int ret;

/*
* By creating our own shmemfs mountpoint, we can pass in
@@ -38,23 +26,8 @@ void i915_gemfs_init(struct drm_i915_private *i915)
if (GRAPHICS_VER(i915) < 11 && !i915_vtd_active(i915))
return;

- if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
- goto err;
-
- type = get_fs_type("tmpfs");
- if (!type)
- goto err;
-
- fc = fs_context_for_mount(type, SB_KERNMOUNT);
- if (IS_ERR(fc))
- goto err;
- ret = add_param(fc, "source", "tmpfs");
- if (!ret)
- ret = add_param(fc, "huge", "within_size");
- if (!ret)
- gemfs = fc_mount_longterm(fc);
- put_fs_context(fc);
- if (ret)
+ gemfs = drm_gem_shmem_huge_mnt_create("within_size");
+ if (IS_ERR(gemfs))
goto err;

i915->mm.gemfs = gemfs;
@@ -70,5 +43,5 @@ void i915_gemfs_init(struct drm_i915_private *i915)

void i915_gemfs_fini(struct drm_i915_private *i915)
{
- kern_unmount(i915->mm.gemfs);
+ drm_gem_shmem_huge_mnt_free(i915->mm.gemfs);
}
--
2.47.3