aboutsummaryrefslogtreecommitdiff
path: root/testcases/kernel/mem
diff options
context:
space:
mode:
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>2021-05-19 10:19:16 -0300
committerCyril Hrubis <chrubis@suse.cz>2021-05-20 13:43:55 +0200
commit9dcbf4e96a41ac69842e705d4dea51fc8e7b0860 (patch)
tree35f373a397ebcc98101d0f99ffd285798cbe4bfc /testcases/kernel/mem
parent6626dc8fd423ff04e2ff553c7bf9a5bedcf94b3b (diff)
downloadltp-9dcbf4e96a41ac69842e705d4dea51fc8e7b0860.tar.gz
mtest06/mmap1: Further limit distant mmap size
Though on recent kernels (starting with 5.2, commit 8c7829b04c523cdc732cb77f59f03320e09f3386 ("mm: fix false-positive OVERCOMMIT_GUESS failures"), overcommit accounting allows for allocating up to MemTotal memory, older kernels have a much more complicated overcommit guess accounting. That leads to mmap failing on small enough systems: mmap1.c:205: TBROK: mmap((nil),2088370176,3,34,-1,0) failed: ENOMEM (12) Allocating only half of the total memory would generally work on test systems. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Acked-by: Jan Stancek <jstancek@redhat.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Diffstat (limited to 'testcases/kernel/mem')
-rw-r--r--testcases/kernel/mem/mtest06/mmap1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/testcases/kernel/mem/mtest06/mmap1.c b/testcases/kernel/mem/mtest06/mmap1.c
index 56588e1eb..10c47c35c 100644
--- a/testcases/kernel/mem/mtest06/mmap1.c
+++ b/testcases/kernel/mem/mtest06/mmap1.c
@@ -186,7 +186,7 @@ static void setup(void)
{
struct sigaction sigptr;
size_t distant_mmap_size;
- long mem_total;
+ size_t mem_total;
page_sz = getpagesize();
mem_total = SAFE_READ_MEMINFO("MemTotal:");
@@ -195,7 +195,7 @@ static void setup(void)
#ifdef TST_ABI32
distant_mmap_size = 256*1024*1024;
#else
- distant_mmap_size = (mem_total > 2 * GIGABYTE) ? 2 * GIGABYTE : mem_total;
+ distant_mmap_size = (mem_total > 4 * GIGABYTE) ? 2 * GIGABYTE : mem_total / 2;
#endif
/*
* Used as hint for mmap thread, so it doesn't interfere