Hugetlb:Migrating the libhugetlbfs tests
v5 cover Hugetlb:Migrating the libhugetlbfs tests
Hi,
Libhugetlbfs is not being maintained actively, and some distro is dropping support for it. There are some tests that are good for testing hugetlb functionality in kernel.
As per previous dicussion in RFC[1], Here, this patch series consists of hugetlb tests taken from libhugetlbfs modified to work in ltp environment.
Based on suggestion[2], I am reposting the patches again. Also, I added suggested changes at [3].
ref:
1:https://lore.kernel.org/all/[email protected]/ 2:https://lore.kernel.org/all/[email protected]/ 3:https://lore.kernel.org/all/[email protected]/
v1 -> v2
1. In (brk near huge) test [PATCH 1/3] removed unused library function test_addr_huge() and read_maps().
v2 -> v3
1. Added a new patch commit for two new flags "needs_hugetlbfs" & "needs_unlinked_hugetlb_file" in tst_test and modified tests to use these flags.
2. Added taint check in test [PATCH 1/3].
3. Removed redundant Hopt and nr_opt option.
4. Corrected pre-processor ARCH based conditional flags in test [PATCH 1/3]
v3 -> v4
1. Removed the needs_unlinked_hugetlb_file option in PATCH[1/4].
2. Removed the redundant saved_oc_hugepages checks in PATCH[3/4].
3. Updated the mntpoint checks in PATCH[1/4].
v4 -> v5
1. Removed the needs_hugetlbfs check from needs_tmpdir function, because mntpoint is now mandatory option with needs_hugetlbfs. (PATCH[1/4])
Tarun Sahu (4):
Hugetlb: Add new tst_test options for hugeltb test support
Hugetlb: Migrating libhugetlbfs brk_near_huge
Hugetlb: Migrating libhugetlbfs chunk-overcommit
Hugetlb: Migrating libhugetlbfs corrupt-by-cow-opt
include/tst_test.h | 11 ++ lib/tst_test.c | 41 ++++- runtest/hugetlb | 3 + testcases/kernel/mem/.gitignore | 3 + .../kernel/mem/hugetlb/hugemmap/Makefile | 5 + .../kernel/mem/hugetlb/hugemmap/hugemmap07.c | 138 ++++++++++++++++ .../kernel/mem/hugetlb/hugemmap/hugemmap08.c | 148 ++++++++++++++++++ .../kernel/mem/hugetlb/hugemmap/hugemmap09.c | 80 ++++++++++ testcases/kernel/mem/hugetlb/lib/hugetlb.h | 3 + 9 files changed, 427 insertions(+), 5 deletions(-) create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap08.c create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap09.c
Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 1/4 Hugetlb: Add new tst_test options for hugeltb test support
Most of libhugetlbfs test require mounted hugetlbfs.
Here, this patch adds a new field in tst_test struct(include/tst_test.h) which user can set if the test requires mounted hugetlbfs. Also, this patch added support to create the unlinked file in the provided dirpath.
--- include/tst_test.h | 11 +++++++++++ lib/tst_test.c | 41 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 5 deletions(-)
include/tst_test.h +11 -0
@@ -176,6 +176,11 @@ struct tst_test { int all_filesystems:1; int skip_in_lockdown:1; int skip_in_compat:1; +/* +* If set, the test function will create a hugetlbfs mount point +* at /tmp/xxxxxx, where xxxxxx is a random string. +*/ + int needs_hugetlbfs:1;/* * The skip_filesystems is a NULL terminated list of filesystems the
@@ -357,6 +362,12 @@ unsigned int tst_remaining_runtime(void);*/ void tst_set_max_runtime (int max_runtime); +/* +* Create and open a random file inside the given dir path. +* It unlinks the file after opening and return file descriptor. +*/ +int tst_creat_unlinked (const char *path); +/* * Returns path to the test temporary directory in a newly allocated buffer. */
lib/tst_test.c +36 -5
71 lines not on this page · raw message
Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 1/4] Hugetlb: Add new tst_test options for hugeltb test support
Hi!
Quoted 17 lines
Most of libhugetlbfs test require mounted hugetlbfs.
Here, this patch adds a new field in
tst_teststruct(include/tst_test.h)which user can set if the test requires mounted hugetlbfs. Also, this patch added support to create the unlinked file in the provided dirpath.Signed-off-by Tarun Sahu <[email protected]>--- include/tst_test.h | 11 +++++++++++ lib/tst_test.c | 41 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 5 deletions(-)include/tst_test.h +0
-0
include/tst_test.h struct tst_test { · line 181
Quoted 6 lines
include/tst_test.h +3
-0@@ -176,6 +176,11 @@ struct tst_test { int all_filesystems:1; int skip_in_lockdown:1; int skip_in_compat:1; +/* +* If set, the test function will create a hugetlbfs mount point +* at /tmp/xxxxxx, where xxxxxx is a random string.
This is no longer up-to-date I guess that this should be:
"If set hugetlbfs will be moutned at .mntpoint"
Quoted 29 lines
include/tst_test.h +8
-0+*/ + int needs_hugetlbfs:1;/* * The skip_filesystems is a NULL terminated list of filesystems the @@ -357,6 +362,12 @@ unsigned int tst_remaining_runtime(void);*/ void tst_set_max_runtime (int max_runtime); +/* +* Create and open a random file inside the given dir path. +* It unlinks the file after opening and return file descriptor. +*/ +int tst_creat_unlinked (const char *path); +/* * Returns path to the test temporary directory in a newly allocated buffer. */ lib/tst_test.c +3
-0@@ -1021,6 +1021,29 @@ static void prepare_and_mount_dev_fs(const char *mntpoint) } } +static void prepare_and_mount_hugetlb_fs (void ) +{ +SAFE_MOUNT ("none" , tst_test->mntpoint,"hugetlbfs" ,0 ,NULL );
lib/tst_test.c static void prepare_and_mount_dev_fs(const char *mntpoint) · line 1036
Quoted 10 lines
lib/tst_test.c +10
-0+ mntpoint_mounted =1 ; +} + +int tst_creat_unlinked (const char *path) +{ +char template[PATH_MAX ]; +int fd; + +snprintf (template,PATH_MAX ,"%s/ltp_%.3sXXXXXX" , + path,TCID );
^
Should be tid in new library code.
lib/tst_test.c static void prepare_and_mount_dev_fs(const char *mntpoint) · line 1041
Quoted 4 lines
lib/tst_test.c +4
-0+ fd =mkstemp (template); +if (fd <0 ) +tst_brk (TBROK |TERRNO , +"%s: mkstemp(%s) failed" , __func__, template);
^ This is not necessary
The tst_brk() prints filename and line number already, there is no need to print the function name as well.
Quoted 39 lines
lib/tst_test.c +11
-3+SAFE_UNLINK (template); +return fd; +} +static const char *limit_tmpfs_mount_size (const char *mnt_data,char *buf,size_t buf_size,const char *fs_type) {@@ -1191,15 +1214,16 @@ static void do_setup(int argc, char *argv[])SAFE_MKDIR (tst_test->mntpoint,0777 );if ((tst_test->needs_devfs || tst_test->needs_rofs || - tst_test->mount_device || tst_test->all_filesystems) && + tst_test->mount_device || tst_test->all_filesystems || + tst_test->needs_hugetlbfs) && !tst_test->mntpoint) {tst_brk (TBROK ,"tst_test->mntpoint must be set!" ); }if (!!tst_test->needs_rofs + !!tst_test->needs_devfs + - !!tst_test->needs_device >1 ) { + !!tst_test->needs_device + !!tst_test->needs_hugetlbfs >1 ) {tst_brk (TBROK , -"Two or more of needs_{rofs, devfs, device} are set" ); +"Two or more of needs_{rofs, devfs, device, hugetlbfs} are set" ); }if (tst_test->needs_devfs)@@ -1217,6 +1241,9 @@ static void do_setup(int argc, char *argv[]) } } +if (tst_test->needs_hugetlbfs) +prepare_and_mount_hugetlb_fs (); +if (tst_test->needs_device && !mntpoint_mounted) { tdev.dev =tst_acquire_device_ (NULL , tst_test->dev_min_size);@@ -1299,8 +1326,12 @@ static void do_cleanup(void)if (ovl_mounted)
lib/tst_test.c static void do_cleanup(void) · line 1334
Quoted 10 lines
lib/tst_test.c +6
-2SAFE_UMOUNT (OVL_MNT ); -if (mntpoint_mounted) -tst_umount (tst_test->mntpoint); +if (mntpoint_mounted) { +if (tst_test->needs_hugetlbfs) +SAFE_UMOUNT (tst_test->mntpoint); +else +tst_umount (tst_test->mntpoint); + }
And I would just keep this umount part as it was.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 1/4] Hugetlb: Add new tst_test options for hugeltb test support
Hi,
Thanks for reviewing the patch.
Quoted 1 line · Cyril Hrubis
Hi!
--skip
Quoted 6 lines
include/tst_test.h struct tst_test { · line 181
Quoted 2 lines
include/tst_test.h +2
-0+* If set, the test function will create a hugetlbfs mount point +* at /tmp/xxxxxx, where xxxxxx is a random string. This is no longer up-to-date I guess that this should be:
"If set hugetlbfs will be moutned at .mntpoint"
Yes, missed it. Will update it.
Quoted 5 lines
include/tst_test.h struct tst_test {
Quoted 5 lines
include/tst_test.h +3
-0+*/ + int needs_hugetlbfs:1; +
--skip
Quoted 10 lines
lib/tst_test.c static void prepare_and_mount_dev_fs(const char *mntpoint) · line 1036
Quoted 7 lines
lib/tst_test.c +7
-0+int tst_creat_unlinked (const char *path) +{ +char template[PATH_MAX ]; +int fd; + +snprintf (template,PATH_MAX ,"%s/ltp_%.3sXXXXXX" , + path,TCID );^
Should be tid in new library code.
Ok, I will update it to tid.
Quoted 11 lines
lib/tst_test.c static void prepare_and_mount_dev_fs(const char *mntpoint) · line 1041
Quoted 4 lines
lib/tst_test.c +4
-0+ fd =mkstemp (template); +if (fd <0 ) +tst_brk (TBROK |TERRNO , +"%s: mkstemp(%s) failed" , __func__, template);^ This is not necessary
The
tst_brk()prints filename and line number already, there is no need to print the function name as well.
Ok.
--skip
Quoted 4 lines
Quoted 4 lines
lib/tst_test.c +0
-0@@ -1299,8 +1326,12 @@ static void do_cleanup(void)if (ovl_mounted)SAFE_UMOUNT (OVL_MNT );
Quoted 11 lines
lib/tst_test.c static void do_cleanup(void) · line 1334
Quoted 8 lines
lib/tst_test.c +6
-2-if (mntpoint_mounted) -tst_umount (tst_test->mntpoint); +if (mntpoint_mounted) { +if (tst_test->needs_hugetlbfs) +SAFE_UMOUNT (tst_test->mntpoint); +else +tst_umount (tst_test->mntpoint); + }And I would just keep this umount part as it was.
Ok, will update it, Anyway, it will throw warning on unsuccessful umount.
Quoted 6 lines
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 2/4 Hugetlb: Migrating libhugetlbfs brk_near_huge
In reply to Tarun SahuMigrating the libhugetlbfs/testcases/brk_near_huge.c test
Test Description:
Certain kernels have a bug where brk() does not perform the same checks that a MAP_FIXED mmap() will, allowing brk() to create a normal page VMA in a hugepage only address region. This can lead to oopses or other badness.
--- runtest/hugetlb | 1 + testcases/kernel/mem/.gitignore | 1 + .../kernel/mem/hugetlb/hugemmap/Makefile | 5 + .../kernel/mem/hugetlb/hugemmap/hugemmap07.c | 138 ++++++++++++++++++ testcases/kernel/mem/hugetlb/lib/hugetlb.h | 3 + 5 files changed, 148 insertions(+) create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c
runtest/hugetlb +1 -0
@@ -3,6 +3,7 @@ hugemmap02 hugemmap02 hugemmap04 hugemmap04 hugemmap05 hugemmap05 hugemmap06 hugemmap06 +hugemmap07 hugemmap07 hugemmap05_1 hugemmap05 -m hugemmap05_2 hugemmap05 -s hugemmap05_3 hugemmap05 -s -m
testcases/kernel/mem/.gitignore +1 -0
@@ -4,6 +4,7 @@ /hugetlb/hugemmap/hugemmap04 /hugetlb/hugemmap/hugemmap05 /hugetlb/hugemmap/hugemmap06 +/hugetlb/hugemmap/hugemmap07 /hugetlb/hugeshmat/hugeshmat01 /hugetlb/hugeshmat/hugeshmat02 /hugetlb/hugeshmat/hugeshmat03
testcases/kernel/mem/hugetlb/hugemmap/Makefile +5 -0
@@ -9,3 +9,8 @@ include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk hugemmap06: CFLAGS+=-pthread + +hugemmap07: +ifeq ($(ARCH),ppc) + CPPFLAGS += -DPPC_NO_SEGMENTS +endif
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c new file +138 -0
138 lines not on this page · raw message
testcases/kernel/mem/hugetlb/lib/hugetlb.h +3 -0
@@ -20,6 +20,9 @@#include "old_tmpdir.h" #include "mem.h" +#define ALIGN (x, a) (((x) + (a) - 1) & ~((a) - 1)) +#define PALIGN (p, a) ((void *)ALIGN((unsigned long)(p), (a))) +#define SHM_RD 0400#define SHM_WR 0200#define SHM_RW (SHM_RD|SHM_WR)
Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 2/4] Hugetlb: Migrating libhugetlbfs brk_near_huge
Hi!
testcases/kernel/mem/hugetlb/hugemmap/Makefile include $(abs_srcdir)/../Makefile.inc · line 16
Quoted 11 lines
testcases/kernel/mem/hugetlb/hugemmap/Makefile +5
-0@@ -9,3 +9,8 @@ include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk hugemmap06: CFLAGS+=-pthread + +hugemmap07: +ifeq ($(ARCH),ppc) + CPPFLAGS += -DPPC_NO_SEGMENTS +endif
I do not think that ARCH is defined in LTP build system. Where does it come from in the original test?
Quoted 7 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c new file +1
-0@@ -0,0 +1,138 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c line 11
Quoted 10 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c new file +10
-0+/* +* Copyright (C) 2005-2006 David Gibson & Adam Litke, IBM Corporation. +* Author: David Gibson & Adam Litke +*/ + +/*\ +* +* [Description] +* +* brk() near hugepage:
^
I would just remove this, it does not render nicely in the asciidoc and it's not useful either.
Quoted 132 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c new file +127
-0+* Certain kernels have a bug where brk() does not perform the same +* checks that a MAP_FIXED mmap() will, allowing brk() to create a +* normal page VMA in a hugepage only address region. This can lead +* to oopses or other badness. +*/ + +#define _GNU_SOURCE +#include <stdio.h> +#include <sys/mount.h> +#include <limits.h> +#include <sys/param.h> +#include <sys/types.h> + +#include "hugetlb.h" +#include "tst_safe_stdio.h" + +#define MNTPOINT "hugetlbfs/" +static long hpage_size; +static int huge_fd =-1 ; + +#ifdef __powerpc64__ +static int arch_has_slice_support (void ) +{ +char mmu_type[16 ]; +FILE *fp; +int ret; + + fp =SAFE_POPEN ("cat /proc/cpuinfo | grep MMU | awk '{ print $3}'" ,"r" ); + ret =fscanf (fp,"%s" , mmu_type); +pclose (fp); + +if (ret <0 ) +tst_brk (TBROK ,"Failed to determine MMU type" ); + +return strcmp (mmu_type,"Hash" ) ==0 ; +} + +static void *next_chunk (void *addr) +{ +if (!arch_has_slice_support ()) +return PALIGN (addr, hpage_size); + +if ((unsigned long )addr <0x100000000UL ) +/* 256M segments below 4G */ +return PALIGN (addr,0x10000000UL ); +/* 1TB segments above */ +return PALIGN (addr,0x10000000000UL ); +} +#elif defined(__powerpc__) && !defined(PPC_NO_SEGMENTS ) +static void *next_chunk (void *addr) +{ +return PALIGN (addr,0x10000000UL ); +} +#elif defined(__ia64__) +static void *next_chunk (void *addr) +{ +return PALIGN (addr,0x8000000000000000UL ); +} +#else +static void *next_chunk (void *addr) +{ +return PALIGN (addr, hpage_size); +} +#endif + +static void run_test (void ) +{ +void *brk0, *hugemap_addr, *newbrk; +char *p; +int err; + + brk0 =sbrk (0 ); +tst_res (TINFO ,"Initial break at %p" , brk0); + + hugemap_addr =next_chunk (brk0) + hpage_size; + + p =SAFE_MMAP (hugemap_addr, hpage_size,PROT_READ |PROT_WRITE , +MAP_PRIVATE |MAP_FIXED , huge_fd,0 ); +if (p != hugemap_addr) { +tst_res (TFAIL ,"mmap() at unexpected address %p instead of %p\n" , p, + hugemap_addr); + goto cleanup; + } + + newbrk =next_chunk (brk0) +getpagesize (); + err =brk ((void *)newbrk); +if (err ==-1 ) { +/* Failing the brk() is an acceptable kernel response */ +tst_res (TPASS ,"Failing the brk is an acceptable response" ); + }else { +/* Suceeding the brk() is acceptable if the new memory is +* properly accesible and we don't have a kernel blow up when +* we touch it. +*/ +tst_res (TINFO ,"New break at %p" , newbrk); +memset (brk0,0 , newbrk-brk0); +tst_res (TPASS ,"memory is accessible, hence successful brk() is " +"an acceptable response" ); + } +cleanup: +SAFE_MUNMAP (p, hpage_size); + err =brk (brk0); +if (err ==-1 ) +tst_brk (TBROK ,"Failed to set break at the original position" ); +} + +static void setup (void ) +{ + hpage_size =SAFE_READ_MEMINFO ("Hugepagesize:" )*1024 ; + huge_fd =tst_creat_unlinked (MNTPOINT ); +} + +static void cleanup (void ) +{ +SAFE_CLOSE (huge_fd); +} + +static struct tst_test test = { + .needs_root =1 , + .mntpoint =MNTPOINT , + .needs_hugetlbfs =1 , + .taint_check =TST_TAINT_D |TST_TAINT_W , + .setup = setup, + .cleanup = cleanup, + .test_all = run_test, + .hugepages = {1 ,TST_NEEDS }, +};testcases/kernel/mem/hugetlb/lib/hugetlb.h +0
-0
testcases/kernel/mem/hugetlb/lib/hugetlb.h line 23
Quoted 4 lines
testcases/kernel/mem/hugetlb/lib/hugetlb.h +1
-0@@ -20,6 +20,9 @@#include "old_tmpdir.h" #include "mem.h" +#define ALIGN (x, a) (((x) + (a) - 1) & ~((a) - 1))
We do have a LTP_ALIGN() please make use of that one instead.
testcases/kernel/mem/hugetlb/lib/hugetlb.h line 28
Quoted 5 lines
testcases/kernel/mem/hugetlb/lib/hugetlb.h +2
-0+#define PALIGN (p, a) ((void *)ALIGN((unsigned long)(p), (a))) +#define SHM_RD 0400#define SHM_WR 0200#define SHM_RW (SHM_RD|SHM_WR)
Have you run 'make check-hugemmap07' in the respecive directory, did it report any problems?
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v5 2/4] Hugetlb: Migrating libhugetlbfs brk_near_huge
Hi,
Quoted 6 lines · Cyril Hrubis
Hi!
Quoted 5 lines
testcases/kernel/mem/hugetlb/hugemmap/Makefile +0
-0@@ -9,3 +9,8 @@ include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk
Quoted 10 lines
testcases/kernel/mem/hugetlb/hugemmap/Makefile include $(abs_srcdir)/../Makefile.inc · line 16
Quoted 6 lines
testcases/kernel/mem/hugetlb/hugemmap/Makefile +5
-0hugemmap06: CFLAGS+=-pthread + +hugemmap07: +ifeq ($(ARCH),ppc) + CPPFLAGS += -DPPC_NO_SEGMENTS +endifI do not think that ARCH is defined in LTP build system. Where does it come from in the original test?
yeah, right. I will amend the code to check for the ARCH. In original code, it explicitly check for ARCH.
Quoted 12 lines
Quoted 12 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c new file +6
-0@@ -0,0 +1,138 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later +/* +* Copyright (C) 2005-2006 David Gibson & Adam Litke, IBM Corporation. +* Author: David Gibson & Adam Litke +*/ +
Quoted 9 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c line 11
Quoted 5 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c new file +5
-0+/*\ +* +* [Description] +* +* brk() near hugepage: ^
I would just remove this, it does not render nicely in the asciidoc and it's not useful either.
Ok.
--skip
Quoted 4 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c line 12
Quoted 2 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c new file +1
-0+#define ALIGN (x, a) (((x) + (a) - 1) & ~((a) - 1))We do have a
LTP_ALIGN()please make use of that one instead.
Ok.
Quoted 10 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c
Quoted 6 lines
testcases/kernel/mem/hugetlb/hugemmap/hugemmap07.c new file +2
-0+#define PALIGN (p, a) ((void *)ALIGN((unsigned long)(p), (a))) +#define SHM_RD 0400#define SHM_WR 0200#define SHM_RW (SHM_RD|SHM_WR)Have you run 'make check-hugemmap07' in the respecive directory, did it report any problems?
Yes, It didn't report any error/warnings.
Quoted 6 lines
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 3/4 Hugetlb: Migrating libhugetlbfs chunk-overcommit
In reply to Tarun SahuMigrating the libhugetlbfs/testcases/chunk-overcommit.c test
Test Description: Some kernel versions after hugepage demand allocation was added used a dubious heuristic to check if there was enough hugepage space available for a given mapping. The number of not-already-instantiated pages in the mapping was compared against the total hugepage free pool. It was very easy to confuse this heuristic into overcommitting by allocating hugepage memory in chunks, each less than the total available pool size but together more than available. This would generally lead to OOM SIGKILLs of one process or another when it tried to instantiate pages beyond the available pool.
--- runtest/hugetlb | 1 + testcases/kernel/mem/.gitignore | 1 + .../kernel/mem/hugetlb/hugemmap/hugemmap08.c | 148 ++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap08.c
runtest/hugetlb +1 -0
@@ -4,6 +4,7 @@ hugemmap04 hugemmap04 hugemmap05 hugemmap05 hugemmap06 hugemmap06 hugemmap07 hugemmap07 +hugemmap08 hugemmap08 hugemmap05_1 hugemmap05 -m hugemmap05_2 hugemmap05 -s hugemmap05_3 hugemmap05 -s -m
testcases/kernel/mem/.gitignore +1 -0
@@ -5,6 +5,7 @@ /hugetlb/hugemmap/hugemmap05 /hugetlb/hugemmap/hugemmap06 /hugetlb/hugemmap/hugemmap07 +/hugetlb/hugemmap/hugemmap08 /hugetlb/hugeshmat/hugeshmat01 /hugetlb/hugeshmat/hugeshmat02 /hugetlb/hugeshmat/hugeshmat03
testcases/kernel/mem/hugetlb/hugemmap/hugemmap08.c new file +148 -0
148 lines not on this page · raw message
Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 4/4 Hugetlb: Migrating libhugetlbfs corrupt-by-cow-opt
In reply to Tarun SahuMigrating the libhugetlbfs/testcases/corrupt-by-cow-opt.c test
Test Description: Test sanity of cow optimization on page cache. If a page in page cache has only 1 ref count, it is mapped for a private mapping directly and is overwritten freely, so next time we access the page, we can see corrupt data.
--- runtest/hugetlb | 1 + testcases/kernel/mem/.gitignore | 1 + .../kernel/mem/hugetlb/hugemmap/hugemmap09.c | 80 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap09.c
runtest/hugetlb +1 -0
@@ -5,6 +5,7 @@ hugemmap05 hugemmap05 hugemmap06 hugemmap06 hugemmap07 hugemmap07 hugemmap08 hugemmap08 +hugemmap09 hugemmap09 hugemmap05_1 hugemmap05 -m hugemmap05_2 hugemmap05 -s hugemmap05_3 hugemmap05 -s -m
testcases/kernel/mem/.gitignore +1 -0
@@ -6,6 +6,7 @@ /hugetlb/hugemmap/hugemmap06 /hugetlb/hugemmap/hugemmap07 /hugetlb/hugemmap/hugemmap08 +/hugetlb/hugemmap/hugemmap09 /hugetlb/hugeshmat/hugeshmat01 /hugetlb/hugeshmat/hugeshmat02 /hugetlb/hugeshmat/hugeshmat03
testcases/kernel/mem/hugetlb/hugemmap/hugemmap09.c new file +80 -0
80 lines not on this page · raw message
Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp