Skip to contentSkip to conversation

overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures"

PATCH New Jan Stancek 2 participants 3 messages May 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures"

commit 8c7829b04c52 ("mm: fix false-positive OVERCOMMIT_GUESS failures") changes logic of __vm_enough_memory(), simplifying it to:
When in GUESS mode, catch wild allocations by comparing their request size to total amount of ram and swap in the system.

Testcase currently allocates mem_total + swap_total, which doesn't trigger new condition. Make it more extreme, but assuming free_total / 2 will PASS, and sum_total * 2 will FAIL.

---
 testcases/kernel/mem/tunable/overcommit_memory.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
testcases/kernel/mem/tunable/overcommit_memory.c +4 -7
index 555298fbfd85..345764dfe427 100644
@@ -36,11 +36,10 @@
  *
  * The program is designed to test the two tunables:
  *
- * When overcommit_memory = 0, allocatable memory can't overextends
- * the amount of free memory. I choose the three cases:
+ * When overcommit_memory = 0, allocatable memory can't overextend
+ * the amount of total memory:
  * a. less than free_total:    free_total / 2, alloc should pass.
- * b. greater than free_total: free_total * 2, alloc should fail.
- * c. equal to sum_total:      sum_tatal,      alloc should fail
+ * b. greater than sum_total:   sum_total * 2, alloc should fail.
  *
  * When overcommit_memory = 1, it can alloc enough much memory, I
  * choose the three cases:
@@ -164,9 +163,7 @@ static void overcommit_memory_test(void)
 
 	update_mem();
 	alloc_and_check(free_total / 2, EXPECT_PASS);
-	update_mem();
-	alloc_and_check(free_total * 2, EXPECT_FAIL);
-	alloc_and_check(sum_total, EXPECT_FAIL);
+	alloc_and_check(sum_total * 2, EXPECT_FAIL);
 
 	/* start to test overcommit_memory=1 */
 	set_sys_tune("overcommit_memory", 1, 1);
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures"

Hi!

Quoted 8 lines

commit 8c7829b04c52 ("mm: fix false-positive OVERCOMMIT_GUESS failures") changes logic of __vm_enough_memory(), simplifying it to:
When in GUESS mode, catch wild allocations by comparing their request size to total amount of ram and swap in the system.

Testcase currently allocates mem_total + swap_total, which doesn't trigger new condition. Make it more extreme, but assuming free_total / 2 will PASS, and sum_total * 2 will FAIL.

Looks good, acked.

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH 1/1 overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures"

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

Quoted 11 lines

Hi!

Quoted 8 lines

commit 8c7829b04c52 ("mm: fix false-positive OVERCOMMIT_GUESS failures") changes logic of __vm_enough_memory(), simplifying it to:
When in GUESS mode, catch wild allocations by comparing their request size to total amount of ram and swap in the system.

Testcase currently allocates mem_total + swap_total, which doesn't trigger new condition. Make it more extreme, but assuming free_total / 2 will PASS, and sum_total * 2 will FAIL.

Looks good, acked.

Pushed.

Quoted 5 lines

--
Cyril Hrubis
[email protected]