[PATCH 00/16] tmpfs: HUGEPAGE and MEM_LOCK fcntls and memfds

From: Hugh Dickins
Date: Fri Jul 30 2021 - 03:23:00 EST


A series of HUGEPAGE and MEM_LOCK tmpfs fcntls and memfd_create flags,
after fixes (not essential for stable) and cleanups in related areas.

Against 5.14-rc3: currently no conflict with linux-next or mmotm.

01/16 huge tmpfs: fix fallocate(vanilla) advance over huge pages
02/16 huge tmpfs: fix split_huge_page() after FALLOC_FL_KEEP_SIZE
03/16 huge tmpfs: remove shrinklist addition from shmem_setattr()
04/16 huge tmpfs: revert shmem's use of transhuge_vma_enabled()
05/16 huge tmpfs: move shmem_huge_enabled() upwards
06/16 huge tmpfs: shmem_is_huge(vma, inode, index)
07/16 memfd: memfd_create(name, MFD_HUGEPAGE) for shmem huge pages
08/16 huge tmpfs: fcntl(fd, F_HUGEPAGE) and fcntl(fd, F_NOHUGEPAGE)
09/16 huge tmpfs: decide stat.st_blksize by shmem_is_huge()
10/16 tmpfs: fcntl(fd, F_MEM_LOCK) to memlock a tmpfs file
11/16 tmpfs: fcntl(fd, F_MEM_LOCKED) to test if memlocked
12/16 tmpfs: refuse memlock when fallocated beyond i_size
13/16 mm: bool user_shm_lock(loff_t size, struct ucounts *)
14/16 mm: user_shm_lock(,,getuc) and user_shm_unlock(,,putuc)
15/16 tmpfs: permit changing size of memlocked file
16/16 memfd: memfd_create(name, MFD_MEM_LOCK) for memlocked shmem

fs/fcntl.c | 8
fs/hugetlbfs/inode.c | 4
include/linux/mm.h | 4
include/linux/shmem_fs.h | 31 ++-
include/uapi/linux/fcntl.h | 17 +
include/uapi/linux/memfd.h | 4
ipc/shm.c | 4
mm/huge_memory.c | 6
mm/khugepaged.c | 2
mm/memfd.c | 27 ++
mm/mlock.c | 19 -
mm/shmem.c | 397 ++++++++++++++++++++++++++-------------
12 files changed, 370 insertions(+), 153 deletions(-)

Hugh