Test for memfd_create() syscall with MFD_HUGETLB flag.
PATCH v4 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 v3 to v4 --
* memfd_create03:
** OR TERRNO with TFAIL for debugging purpose.
** Move helper functions from memfd_create_hugetlb.c to the
main test code.
* memfd_create04:
** Replace huge pages support check using procfs with sysfs.
--- include/lapi/memfd.h | 33 +++ runtest/syscalls | 2 + .../kernel/syscalls/memfd_create/.gitignore | 2 + .../syscalls/memfd_create/memfd_create03.c | 263 ++++++++++++++++++ .../syscalls/memfd_create/memfd_create04.c | 105 +++++++ 5 files changed, 405 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
@@ -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
@@ -1481,5 +1481,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
@@ -1,2 +1,4 @@ /memfd_create01 /memfd_create02 +/memfd_create03 +/memfd_create04
testcases/kernel/syscalls/memfd_create/memfd_create03.c new file +263 -0
263 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
PATCH v4 1/1 Test for memfd_create() syscall with MFD_HUGETLB flag.
----- Original Message -----
Quoted 11 lines
*
memfd_create03: Tests the syscall for the flagMFD_HUGETLB.*
memfd_create04: Tests the syscall for the flagsMFD_HUGE_2MB,MFD_HUGE_1GB,... used in conjunction withMFD_HUGETLBflag.-- major changes from v3 to v4 --
*
memfd_create03:
Quoted 8 lines
** OR TERRNO with TFAIL for debugging purpose.
** Move helper functions from
memfd_create_hugetlb.cto the
main test code.*
memfd_create04:** Replace huge pages support check using procfs with sysfs.
Hi,
+1 for making it simpler (code has been reduced by ~33%).
There is a small problem with setup() in memfd_create03:
# ./memfd_create03 tst_test.c:1017: INFO: Timeout per run is 0h 05m 00s safe_file_ops.c:220: BROK: Expected 1 conversions got 0 at memfd_create03.c:211
We should check also that "/sys/kernel/mm/hugepages" exists. "/proc/sys/vm/nr_hugepages" exists even on systems which do not support huge pages.
# cat /proc/sys/vm/nr_hugepages cat: /proc/sys/vm/nr_hugepages: Operation not supported
memfd_create04 is checking for it already, and reports TCONF.
---
Other than that v4 looks OK to me. I'm still looking at testing it on aarch64.
Regards,
Jan
PATCH v4 1/1 Test for memfd_create() syscall withMFD_HUGETLBflag.
Hi,
We will work on that and update.
Thanks and Regards,
Vishnu K