[Intel-gfx] [PATCH] drm/i915: Prevent GFP with !CONFIG_TMPFS and remounting shmemfs

Chris Wilson chris at chris-wilson.co.uk
Sun Jul 14 12:39:23 UTC 2019


If CONFIG_TMPFS is not set, then the shmemfs does not support
remounting. We are using the remount in order to set mount options on
our private gemfs (shmemfs) kern_mount. If we can't pass options
directly on creating the mountpoint, and we can't reliably remount, set
the option within the superblock directly. Unfortunately the defines for
sb_info->huge are private to shmemfs, so we have to hope they don't
change without us noticing.

Reported-by: Heiner Kallweit <hkallweit1 at gmail.com>
Fixes: b901bb89324a ("drm/i915/gemfs: enable THP")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Cc: Heiner Kallweit <hkallweit1 at gmail.com>
---
 drivers/gpu/drm/i915/gem/i915_gemfs.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gemfs.c b/drivers/gpu/drm/i915/gem/i915_gemfs.c
index 099f3397aada..5910315f2069 100644
--- a/drivers/gpu/drm/i915/gem/i915_gemfs.c
+++ b/drivers/gpu/drm/i915/gem/i915_gemfs.c
@@ -7,6 +7,7 @@
 #include <linux/fs.h>
 #include <linux/mount.h>
 #include <linux/pagemap.h>
+#include <linux/shmem_fs.h>
 
 #include "i915_drv.h"
 #include "i915_gemfs.h"
@@ -33,17 +34,10 @@ int i915_gemfs_init(struct drm_i915_private *i915)
 	 */
 
 	if (has_transparent_hugepage()) {
-		struct super_block *sb = gemfs->mnt_sb;
+		struct shmem_sb_info *sb_info = gemfs->mnt_sb->s_fs_info;
+
 		/* FIXME: Disabled until we get W/A for read BW issue. */
-		char options[] = "huge=never";
-		int flags = 0;
-		int err;
-
-		err = sb->s_op->remount_fs(sb, &flags, options);
-		if (err) {
-			kern_unmount(gemfs);
-			return err;
-		}
+		sb_info->huge = 0; /* SHMEM_HUGE_NEVER */
 	}
 
 	i915->mm.gemfs = gemfs;
-- 
2.22.0



More information about the Intel-gfx mailing list