diff mbox series

[v4,8/8] drm/v3d: Add modparam for turning off Big/Super Pages

Message ID 20240428124426.309096-9-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/v3d: Enable Big and Super Pages | expand

Commit Message

Maíra Canal April 28, 2024, 12:40 p.m. UTC
Add a modparam for turning off Big/Super Pages to make sure that if an
user doesn't want Big/Super Pages enabled, it can disabled it by setting
the modparam to false.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/v3d/v3d_drv.c   | 7 +++++++
 drivers/gpu/drm/v3d/v3d_gemfs.c | 5 +++++
 2 files changed, 12 insertions(+)

Comments

Tvrtko Ursulin April 29, 2024, 8:24 a.m. UTC | #1
On 28/04/2024 13:40, Maíra Canal wrote:
> Add a modparam for turning off Big/Super Pages to make sure that if an
> user doesn't want Big/Super Pages enabled, it can disabled it by setting
> the modparam to false.
> 
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> ---
>   drivers/gpu/drm/v3d/v3d_drv.c   | 7 +++++++
>   drivers/gpu/drm/v3d/v3d_gemfs.c | 5 +++++
>   2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index 28b7ddce7747..1a6e01235df6 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -36,6 +36,13 @@
>   #define DRIVER_MINOR 0
>   #define DRIVER_PATCHLEVEL 0
>   
> +/* Only expose the `super_pages` modparam if THP is enabled. */
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> +bool super_pages = true;
> +module_param_named(super_pages, super_pages, bool, 0400);
> +MODULE_PARM_DESC(super_pages, "Enable/Disable Super Pages support.");
> +#endif
> +
>   static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
>   			       struct drm_file *file_priv)
>   {
> diff --git a/drivers/gpu/drm/v3d/v3d_gemfs.c b/drivers/gpu/drm/v3d/v3d_gemfs.c
> index 31cf5bd11e39..0ade02bb7209 100644
> --- a/drivers/gpu/drm/v3d/v3d_gemfs.c
> +++ b/drivers/gpu/drm/v3d/v3d_gemfs.c
> @@ -11,6 +11,7 @@ void v3d_gemfs_init(struct v3d_dev *v3d)
>   	char huge_opt[] = "huge=within_size";
>   	struct file_system_type *type;
>   	struct vfsmount *gemfs;
> +	extern bool super_pages;
>   
>   	/*
>   	 * By creating our own shmemfs mountpoint, we can pass in
> @@ -20,6 +21,10 @@ void v3d_gemfs_init(struct v3d_dev *v3d)
>   	if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
>   		goto err;
>   
> +	/* The user doesn't want to enable Super Pages */
> +	if (!super_pages)
> +		goto err;
> +
>   	type = get_fs_type("tmpfs");
>   	if (!type)
>   		goto err;

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index 28b7ddce7747..1a6e01235df6 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -36,6 +36,13 @@ 
 #define DRIVER_MINOR 0
 #define DRIVER_PATCHLEVEL 0
 
+/* Only expose the `super_pages` modparam if THP is enabled. */
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+bool super_pages = true;
+module_param_named(super_pages, super_pages, bool, 0400);
+MODULE_PARM_DESC(super_pages, "Enable/Disable Super Pages support.");
+#endif
+
 static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
 			       struct drm_file *file_priv)
 {
diff --git a/drivers/gpu/drm/v3d/v3d_gemfs.c b/drivers/gpu/drm/v3d/v3d_gemfs.c
index 31cf5bd11e39..0ade02bb7209 100644
--- a/drivers/gpu/drm/v3d/v3d_gemfs.c
+++ b/drivers/gpu/drm/v3d/v3d_gemfs.c
@@ -11,6 +11,7 @@  void v3d_gemfs_init(struct v3d_dev *v3d)
 	char huge_opt[] = "huge=within_size";
 	struct file_system_type *type;
 	struct vfsmount *gemfs;
+	extern bool super_pages;
 
 	/*
 	 * By creating our own shmemfs mountpoint, we can pass in
@@ -20,6 +21,10 @@  void v3d_gemfs_init(struct v3d_dev *v3d)
 	if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
 		goto err;
 
+	/* The user doesn't want to enable Super Pages */
+	if (!super_pages)
+		goto err;
+
 	type = get_fs_type("tmpfs");
 	if (!type)
 		goto err;