Skip to content

Commit 9dcbf4e

Browse files
Thadeu Lima de Souza Cascardometan-ucw
authored andcommitted
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 <[email protected]> Acked-by: Jan Stancek <[email protected]> Reviewed-by: Cyril Hrubis <[email protected]>
1 parent 6626dc8 commit 9dcbf4e

File tree

1 file changed

+2
-2
lines changed
  • testcases/kernel/mem/mtest06

1 file changed

+2
-2
lines changed

testcases/kernel/mem/mtest06/mmap1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void setup(void)
186186
{
187187
struct sigaction sigptr;
188188
size_t distant_mmap_size;
189-
long mem_total;
189+
size_t mem_total;
190190

191191
page_sz = getpagesize();
192192
mem_total = SAFE_READ_MEMINFO("MemTotal:");
@@ -195,7 +195,7 @@ static void setup(void)
195195
#ifdef TST_ABI32
196196
distant_mmap_size = 256*1024*1024;
197197
#else
198-
distant_mmap_size = (mem_total > 2 * GIGABYTE) ? 2 * GIGABYTE : mem_total;
198+
distant_mmap_size = (mem_total > 4 * GIGABYTE) ? 2 * GIGABYTE : mem_total / 2;
199199
#endif
200200
/*
201201
* Used as hint for mmap thread, so it doesn't interfere

0 commit comments

Comments
 (0)