Re: [PATCH] mm,hugetlb: compute page_size_log properly

From: Mike Kravetz
Date: Mon Jul 17 2017 - 18:30:09 EST


I hate to resurrect this thread, but I would like to add hugetlb support
to memfd_create. This is for JVM garbage collection as discussed in
this thread [1].

Adding hugetlb support to memfd_create, means that memfd_create will take
a flag something like MFD_HUGETLB. And, if a user wants hugetlb pages
they may want a huge page size different than the system default. So, it
make sense to use the same type of encoding used by mmap and shmget.
However, I would hate to copy/paste the same values used by mmap and shmget
and just give them different names. So, how about something like the
following:

1) Put all the log2 encoded huge page size definitions in a common header
file.
2) Arch specific code can use these values, or overwrite as needed.
3) All system calls using this encoding (mmap, shmget and memfd_create in
the future) will use these common values.

I have also put the shm user space definitions in the uapi file as
previously suggested by Matthew Wilcox. I did not (yet) move the
shm definitions to arch specific files as suggested by Aneesh Kumar.

[1] https://lkml.org/lkml/2017/7/6/564

Mike Kravetz (3):
mm:hugetlb: Define system call hugetlb size encodings in single file
mm: arch: Use new hugetlb size encoding definitions
mm: shm: Use new hugetlb size encoding definitions

arch/alpha/include/uapi/asm/mman.h | 14 ++++++--------
arch/mips/include/uapi/asm/mman.h | 14 ++++++--------
arch/parisc/include/uapi/asm/mman.h | 14 ++++++--------
arch/powerpc/include/uapi/asm/mman.h | 23 ++++++++++-------------
arch/x86/include/uapi/asm/mman.h | 10 ++++++++--
arch/xtensa/include/uapi/asm/mman.h | 14 ++++++--------
include/linux/shm.h | 17 -----------------
include/uapi/asm-generic/hugetlb_encode.h | 30 ++++++++++++++++++++++++++++++
include/uapi/asm-generic/mman-common.h | 6 ++++--
include/uapi/linux/shm.h | 23 +++++++++++++++++++++--
10 files changed, 97 insertions(+), 68 deletions(-)
create mode 100644 include/uapi/asm-generic/hugetlb_encode.h

--
2.7.5