Re: [PATCH v2 08/13] mm: update shmem_[kernel]_file_*() functions to use vma_flags_t

Lorenzo Stoakes
2026-01-23T12:31:00Z

On Fri, Jan 23, 2026 at 02:20:51PM +0800, Baolin Wang wrote:
>
>
> On 1/23/26 12:06 AM, Lorenzo Stoakes wrote:
> > 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.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>
> (reduced distribution list too)
>
> Thanks. The shmem part looks good to me with some nits below.
>
> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

Thanks!

>
> > ---
> > 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/memfd_luo.c | 2 +-
> > mm/shmem.c | 59 +++++++++++++----------
> > security/keys/big_key.c | 2 +-
> > 16 files changed, 57 insertions(+), 49 deletions(-)
>
> [snip]
>
> > inode->i_flags |= i_flags;
> > @@ -5864,9 +5869,10 @@ static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name,
> > * checks are provided at the key or shm level rather than the inode.
> > * @name: name for dentry (to be seen in /proc/<pid>/maps)
> > * @size: size to be set for the file
> > - * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
> > + * @vma_flags: VMA_NORESERVE_BIT suppresses pre-accounting of the entire object size
>
> nit: s/vma_flags/flags
>
> > */
> > -struct file *shmem_kernel_file_setup(const char *name, loff_t size, unsigned long flags)
> > +struct file *shmem_kernel_file_setup(const char *name, loff_t size,
> > + vma_flags_t flags)
> > {
> > return __shmem_file_setup(shm_mnt, name, size, flags, S_PRIVATE);
> > }
> > @@ -5878,7 +5884,7 @@ EXPORT_SYMBOL_GPL(shmem_kernel_file_setup);
> > * @size: size to be set for the file
> > * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
>
> nit: s/VM_NORESERVE/VMA_NORESERVE_BIT

Good spots, will send fix-patch.

Cheers, Lorenzo