Skip to content

RFC Add flag as THP allocation hint for memfd_restricted() syscall

Ackerley Tng kvm linux-api linux-arch linux-doc linux-fsdevel linux-mm lkml qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm: restrictedmem: Add flag as THP allocation hint for memfd_restricted() syscallinclude/uapi/linux/restrictedmem.h mm/restrictedmem.c+18 -100 replies
2/2selftests: restrictedmem: Add selftest for RMFD_HUGEPAGEtools/testing/selftests/restrictedmem/restrictedmem_hugepage_test.c+25 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] Add flag as THP allocation hint for memfd_restricted() syscall

Hello,

This patchset builds upon the memfd_restricted() system call that has been discussed in the ‘KVM: mm: fd-based approach for supporting KVM’ patch series, at
https://lore.kernel.org/lkml/[email protected]/T/#m7e944d7892afdd1d62a03a287bd488c56e377b0c

The tree can be found at:
https://github.com/googleprodkernel/linux-cc/tree/restrictedmem-rmfd-hugepage

Following the RFC to provide mount for memfd_restricted() syscall at
https://lore.kernel.org/lkml/[email protected]/T/#u,
this patchset adds the RMFD_HUGEPAGE flag to the memfd_restricted() syscall, which will hint the kernel to use Transparent HugePages to back restrictedmem pages.

This supplements the interface proposed earlier, which requires the creation of a tmpfs mount to be passed to memfd_restricted(), with a more direct per-file hint.

Dependencies:

+ Sean’s iteration of the ‘KVM: mm: fd-based approach for supporting KVM’ patch series at
https://github.com/sean-jc/linux/tree/x86/upm_base_support
+ Proposed fix for restrictedmem_getattr() as mentioned on the mailing list at
https://lore.kernel.org/lkml/[email protected]/
+ Hugh’s patch:
https://lore.kernel.org/lkml/[email protected]/,
which provides functionality in shmem that reads the VM_HUGEPAGE flag in key functions shmem_is_huge() and shmem_get_inode()

Future work/TODOs:
+ man page for the memfd_restricted() syscall
+ Support for per file NUMA binding hints

Ackerley Tng (2):
mm: restrictedmem: Add flag as THP allocation hint for
memfd_restricted() syscall
selftests: restrictedmem: Add selftest for RMFD_HUGEPAGE

 include/uapi/linux/restrictedmem.h            |  1 +
 mm/restrictedmem.c                            | 27 ++++++++++++-------
 .../restrictedmem_hugepage_test.c             | 25 +++++++++++++++++
 3 files changed, 43 insertions(+), 10 deletions(-)

--
2.39.2.637.g21b0678d19-goog