Skip to contentSkip to conversation

Test for memfd_create() syscall with MFD_HUGETLB flag.

PATCH New Vishnu K 2 participants 3 messages Aug 9, 2018 – Aug 21, 2018

lore
Share & tools
lore

Vishnu K

author
#0 lore raw

PATCH v5 1/1 Test for memfd_create() syscall with MFD_HUGETLB flag.

* memfd_create03: Tests the syscall for the flag MFD_HUGETLB.

* memfd_create04: Tests the syscall for the flags MFD_HUGE_2MB, MFD_HUGE_1GB, ... used in conjunction with MFD_HUGETLB flag.

-- major changes from v4 to v5 --

* memfd_create03:

** Add system huge page support check using sysfs.

---
 include/lapi/memfd.h                          |  33 +++
 runtest/syscalls                              |   2 +
 .../kernel/syscalls/memfd_create/.gitignore   |   2 +
 .../syscalls/memfd_create/memfd_create03.c    | 265 ++++++++++++++++++
 .../syscalls/memfd_create/memfd_create04.c    | 105 +++++++
 5 files changed, 407 insertions(+)
 create mode 100644 testcases/kernel/syscalls/memfd_create/memfd_create03.c
 create mode 100644 testcases/kernel/syscalls/memfd_create/memfd_create04.c
include/lapi/memfd.h +33 -0
index 18ed40fc6..12a91f4a9 100644
@@ -24,4 +24,37 @@
 # define MFD_ALLOW_SEALING       0x0002U
 #endif
 
+/* flags for memfd_create(3) and memfd_create(4) */
+#ifndef MFD_HUGETLB
+#define MFD_HUGETLB 0x0004U
+#endif
+
+#ifndef MFD_HUGE_64KB
+#define MFD_HUGE_64KB (16 << 26)
+#endif
+#ifndef MFD_HUGE_512KB
+#define MFD_HUGE_512KB (19 << 26)
+#endif
+#ifndef MFD_HUGE_2MB
+#define MFD_HUGE_2MB (21 << 26)
+#endif
+#ifndef MFD_HUGE_8MB
+#define MFD_HUGE_8MB (23 << 26)
+#endif
+#ifndef MFD_HUGE_16MB
+#define MFD_HUGE_16MB (24 << 26)
+#endif
+#ifndef MFD_HUGE_256MB
+#define MFD_HUGE_256MB (28 << 26)
+#endif
+#ifndef MFD_HUGE_1GB
+#define MFD_HUGE_1GB (30 << 26)
+#endif
+#ifndef MFD_HUGE_2GB
+#define MFD_HUGE_2GB (31 << 26)
+#endif
+#ifndef MFD_HUGE_16GB
+#define MFD_HUGE_16GB (34 << 26)
+#endif
+
 #endif
runtest/syscalls +2 -0
index b78f6bc02..9d0eac8f1 100644
@@ -1488,5 +1488,7 @@ futex_wait_bitset02 futex_wait_bitset02
 
 memfd_create01 memfd_create01
 memfd_create02 memfd_create02
+memfd_create03 memfd_create03
+memfd_create04 memfd_create04
 
 copy_file_range01 copy_file_range01
testcases/kernel/syscalls/memfd_create/.gitignore +2 -0
index 9b20604ab..71b898c34 100644
@@ -1,2 +1,4 @@
 /memfd_create01
 /memfd_create02
+/memfd_create03
+/memfd_create04
\ No newline@end of file
testcases/kernel/syscalls/memfd_create/memfd_create03.c new file +265 -0

265 lines not on this page · raw message

testcases/kernel/syscalls/memfd_create/memfd_create04.c new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw

PATCH v5 1/1 Test for memfd_create() syscall with MFD_HUGETLB flag.

----- Original Message -----

Quoted 7 lines

* memfd_create03: Tests the syscall for the flag MFD_HUGETLB.

* memfd_create04: Tests the syscall for the flags MFD_HUGE_2MB, MFD_HUGE_1GB, ... used in conjunction with MFD_HUGETLB flag.

Quoted 8 lines

-- major changes from v4 to v5 --

* memfd_create03:

** Add system huge page support check using sysfs.

Tests look good on x86, ppc and aarch64. Pushed.

Regards,
Jan

author
#2 lore raw

PATCH v5 1/1 Test for memfd_create() syscall withMFD_HUGETLBflag.

Hi,

Thanks for your time and effort reviewing the code.

Regards,
Vishnu K