Skip to contentSkip to conversation

mm-update-shmem__file_-functions-to-use-vma_flags_t.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Feb 12

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: update shmem_[kernel]_file_*() functions to use vma_flags_t
has been removed from the -mm tree. Its filename was
mm-update-shmem__file_-functions-to-use-vma_flags_t.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Lorenzo Stoakes <[email protected]>
Subject: mm: update shmem_[kernel]_file_*() functions to use vma_flags_t
Date: Thu, 22 Jan 2026 16:06:17 +0000

In order to be able to use only vma_flags_t in vm_area_desc we must adjust shmem file setup functions to operate in terms of vma_flags_t rather than vm_flags_t.

This patch makes this change and updates all callers to use the new functions.

No functional changes intended.

---

 arch/x86/kernel/cpu/sgx/ioctl.c           |    2 
 drivers/gpu/drm/drm_gem.c                 |    5 -
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c |    2 
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c   |    3 
 drivers/gpu/drm/i915/gt/shmem_utils.c     |    3 
 drivers/gpu/drm/ttm/tests/ttm_tt_test.c   |    2 
 drivers/gpu/drm/ttm/ttm_backup.c          |    3 
 drivers/gpu/drm/ttm/ttm_tt.c              |    2 
 fs/xfs/scrub/xfile.c                      |    3 
 fs/xfs/xfs_buf_mem.c                      |    2 
 include/linux/shmem_fs.h                  |    8 --
 ipc/shm.c                                 |    6 -
 mm/memfd.c                                |    2 
 mm/shmem.c                                |   61 +++++++++++---------
 security/keys/big_key.c                   |    2 
 15 files changed, 57 insertions(+), 49 deletions(-)
arch/x86/kernel/cpu/sgx/ioctl.c renamed from arch/x86/kernel/cpu/sgx/ioctl.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +1 -1
@@ -83,7 +83,7 @@ static int sgx_encl_create(struct sgx_en
 	encl_size = secs->size + PAGE_SIZE;
 
 	backing = shmem_file_setup("SGX backing", encl_size + (encl_size >> 5),
-				   VM_NORESERVE);
+				   mk_vma_flags(VMA_NORESERVE_BIT));
 	if (IS_ERR(backing)) {
 		ret = PTR_ERR(backing);
 		goto err_out_shrink;
drivers/gpu/drm/drm_gem.c renamed from drivers/gpu/drm/drm_gem.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +3 -2
@@ -130,14 +130,15 @@ int drm_gem_object_init_with_mnt(struct
 				 struct vfsmount *gemfs)
 {
 	struct file *filp;
+	const vma_flags_t flags = mk_vma_flags(VMA_NORESERVE_BIT);
 
 	drm_gem_private_object_init(dev, obj, size);
 
 	if (gemfs)
 		filp = shmem_file_setup_with_mnt(gemfs, "drm mm object", size,
-						 VM_NORESERVE);
+						 flags);
 	else
-		filp = shmem_file_setup("drm mm object", size, VM_NORESERVE);
+		filp = shmem_file_setup("drm mm object", size, flags);
 
 	if (IS_ERR(filp))
 		return PTR_ERR(filp);
drivers/gpu/drm/i915/gem/i915_gem_shmem.c renamed from drivers/gpu/drm/i915/gem/i915_gem_shmem.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +1 -1
@@ -496,7 +496,7 @@ static int __create_shmem(struct drm_i91
 			  struct drm_gem_object *obj,
 			  resource_size_t size)
 {
-	unsigned long flags = VM_NORESERVE;
+	const vma_flags_t flags = mk_vma_flags(VMA_NORESERVE_BIT);
 	struct file *filp;
 
 	drm_gem_private_object_init(&i915->drm, obj, size);
drivers/gpu/drm/i915/gem/i915_gem_ttm.c renamed from drivers/gpu/drm/i915/gem/i915_gem_ttm.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +2 -1
@@ -200,7 +200,8 @@ static int i915_ttm_tt_shmem_populate(st
 		struct address_space *mapping;
 		gfp_t mask;
 
-		filp = shmem_file_setup("i915-shmem-tt", size, VM_NORESERVE);
+		filp = shmem_file_setup("i915-shmem-tt", size,
+					mk_vma_flags(VMA_NORESERVE_BIT));
 		if (IS_ERR(filp))
 			return PTR_ERR(filp);
 
drivers/gpu/drm/i915/gt/shmem_utils.c renamed from drivers/gpu/drm/i915/gt/shmem_utils.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +2 -1
@@ -19,7 +19,8 @@ struct file *shmem_create_from_data(cons
 	struct file *file;
 	int err;
 
-	file = shmem_file_setup(name, PAGE_ALIGN(len), VM_NORESERVE);
+	file = shmem_file_setup(name, PAGE_ALIGN(len),
+				mk_vma_flags(VMA_NORESERVE_BIT));
 	if (IS_ERR(file))
 		return file;
 
drivers/gpu/drm/ttm/tests/ttm_tt_test.c renamed from drivers/gpu/drm/ttm/tests/ttm_tt_test.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +1 -1
@@ -143,7 +143,7 @@ static void ttm_tt_fini_shmem(struct kun
 	err = ttm_tt_init(tt, bo, 0, caching, 0);
 	KUNIT_ASSERT_EQ(test, err, 0);
 
-	shmem = shmem_file_setup("ttm swap", BO_SIZE, 0);
+	shmem = shmem_file_setup("ttm swap", BO_SIZE, EMPTY_VMA_FLAGS);
 	tt->swap_storage = shmem;
 
 	ttm_tt_fini(tt);
drivers/gpu/drm/ttm/ttm_backup.c renamed from drivers/gpu/drm/ttm/ttm_backup.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +2 -1
@@ -178,5 +178,6 @@ EXPORT_SYMBOL_GPL(ttm_backup_bytes_avail
  */
 struct file *ttm_backup_shmem_create(loff_t size)
 {
-	return shmem_file_setup("ttm shmem backup", size, 0);
+	return shmem_file_setup("ttm shmem backup", size,
+				EMPTY_VMA_FLAGS);
 }
drivers/gpu/drm/ttm/ttm_tt.c renamed from drivers/gpu/drm/ttm/ttm_tt.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +1 -1
@@ -330,7 +330,7 @@ int ttm_tt_swapout(struct ttm_device *bd
 	struct page *to_page;
 	int i, ret;
 
-	swap_storage = shmem_file_setup("ttm swap", size, 0);
+	swap_storage = shmem_file_setup("ttm swap", size, EMPTY_VMA_FLAGS);
 	if (IS_ERR(swap_storage)) {
 		pr_err("Failed allocating swap storage\n");
 		return PTR_ERR(swap_storage);
fs/xfs/scrub/xfile.c renamed from fs/xfs/scrub/xfile.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +2 -1
@@ -61,7 +61,8 @@ xfile_create(
 	if (!xf)
 		return -ENOMEM;
 
-	xf->file = shmem_kernel_file_setup(description, isize, VM_NORESERVE);
+	xf->file = shmem_kernel_file_setup(description, isize,
+					   mk_vma_flags(VMA_NORESERVE_BIT));
 	if (IS_ERR(xf->file)) {
 		error = PTR_ERR(xf->file);
 		goto out_xfile;
fs/xfs/xfs_buf_mem.c renamed from fs/xfs/xfs_buf_mem.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +1 -1
@@ -62,7 +62,7 @@ xmbuf_alloc(
 	if (!btp)
 		return -ENOMEM;
 
-	file = shmem_kernel_file_setup(descr, 0, 0);
+	file = shmem_kernel_file_setup(descr, 0, EMPTY_VMA_FLAGS);
 	if (IS_ERR(file)) {
 		error = PTR_ERR(file);
 		goto out_free_btp;
include/linux/shmem_fs.h renamed from include/linux/shmem_fs.h~mm-update-shmem__file_-functions-to-use-vma_flags_t +3 -5
@@ -102,12 +102,10 @@ static inline struct shmem_inode_info *S
 extern const struct fs_parameter_spec shmem_fs_parameters[];
 extern void shmem_init(void);
 extern int shmem_init_fs_context(struct fs_context *fc);
-extern struct file *shmem_file_setup(const char *name,
-					loff_t size, unsigned long flags);
-extern struct file *shmem_kernel_file_setup(const char *name, loff_t size,
-					    unsigned long flags);
+struct file *shmem_file_setup(const char *name, loff_t size, vma_flags_t flags);
+struct file *shmem_kernel_file_setup(const char *name, loff_t size, vma_flags_t vma_flags);
 extern struct file *shmem_file_setup_with_mnt(struct vfsmount *mnt,
-		const char *name, loff_t size, unsigned long flags);
+		const char *name, loff_t size, vma_flags_t flags);
 int shmem_zero_setup(struct vm_area_struct *vma);
 int shmem_zero_setup_desc(struct vm_area_desc *desc);
 extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr,
ipc/shm.c renamed from ipc/shm.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +2 -4
@@ -708,6 +708,7 @@ static int newseg(struct ipc_namespace *
 	struct shmid_kernel *shp;
 	size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
 	const bool has_no_reserve = shmflg & SHM_NORESERVE;
+	vma_flags_t acctflag = EMPTY_VMA_FLAGS;
 	struct file *file;
 	char name[13];
 
@@ -738,7 +739,6 @@ static int newseg(struct ipc_namespace *
 
 	sprintf(name, "SYSV%08x", key);
 	if (shmflg & SHM_HUGETLB) {
-		vma_flags_t acctflag = EMPTY_VMA_FLAGS;
 		struct hstate *hs;
 		size_t hugesize;
 
@@ -755,14 +755,12 @@ static int newseg(struct ipc_namespace *
 		file = hugetlb_file_setup(name, hugesize, acctflag,
 				HUGETLB_SHMFS_INODE, (shmflg >> SHM_HUGE_SHIFT) & SHM_HUGE_MASK);
 	} else {
-		vm_flags_t acctflag = 0;
-
 		/*
 		 * Do not allow no accounting for OVERCOMMIT_NEVER, even
 		 * if it's asked for.
 		 */
 		if  (has_no_reserve && sysctl_overcommit_memory != OVERCOMMIT_NEVER)
-			acctflag = VM_NORESERVE;
+			vma_flags_set(&acctflag, VMA_NORESERVE_BIT);
 		file = shmem_kernel_file_setup(name, size, acctflag);
 	}
 	error = PTR_ERR(file);
mm/memfd.c renamed from mm/memfd.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +1 -1
@@ -468,7 +468,7 @@ struct file *memfd_alloc_file(const char
 					(flags >> MFD_HUGE_SHIFT) &
 					MFD_HUGE_MASK);
 	} else {
-		file = shmem_file_setup(name, 0, VM_NORESERVE);
+		file = shmem_file_setup(name, 0, mk_vma_flags(VMA_NORESERVE_BIT));
 	}
 	if (IS_ERR(file))
 		return file;
mm/shmem.c renamed from mm/shmem.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +34 -27

179 lines not on this page · raw message

security/keys/big_key.c renamed from security/keys/big_key.c~mm-update-shmem__file_-functions-to-use-vma_flags_t +1 -1
@@ -103,7 +103,7 @@ int big_key_preparse(struct key_preparse
 					 0, enckey);
 
 		/* save aligned data to file */
-		file = shmem_kernel_file_setup("", enclen, 0);
+		file = shmem_kernel_file_setup("", enclen, EMPTY_VMA_FLAGS);
 		if (IS_ERR(file)) {
 			ret = PTR_ERR(file);
 			goto err_enckey;

_

Patches currently in -mm which might be from [email protected] are