2 * SPDX-License-Identifier: MIT
4 * Copyright © 2017 Intel Corporation
8 #include <linux/mount.h>
9 #include <linux/pagemap.h>
12 #include "i915_gemfs.h"
14 int i915_gemfs_init(struct drm_i915_private *i915)
16 struct file_system_type *type;
17 struct vfsmount *gemfs;
19 type = get_fs_type("tmpfs");
23 gemfs = kern_mount(type);
25 return PTR_ERR(gemfs);
28 * Enable huge-pages for objects that are at least HPAGE_PMD_SIZE, most
29 * likely 2M. Note that within_size may overallocate huge-pages, if say
30 * we allocate an object of size 2M + 4K, we may get 2M + 2M, but under
31 * memory pressure shmem should split any huge-pages which can be
35 if (has_transparent_hugepage()) {
36 struct super_block *sb = gemfs->mnt_sb;
37 /* FIXME: Disabled until we get W/A for read BW issue. */
38 char options[] = "huge=never";
42 err = sb->s_op->remount_fs(sb, &flags, options);
49 i915->mm.gemfs = gemfs;
54 void i915_gemfs_fini(struct drm_i915_private *i915)
56 kern_unmount(i915->mm.gemfs);