All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures"
@ 2019-05-21  8:25 Jan Stancek
  2019-05-21 13:29 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2019-05-21  8:25 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/mem/tunable/overcommit_memory.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/testcases/kernel/mem/tunable/overcommit_memory.c b/testcases/kernel/mem/tunable/overcommit_memory.c
index 555298fbfd85..345764dfe427 100644
--- a/testcases/kernel/mem/tunable/overcommit_memory.c
+++ b/testcases/kernel/mem/tunable/overcommit_memory.c
@@ -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);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH] overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures"
  2019-05-21  8:25 [LTP] [PATCH] overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures" Jan Stancek
@ 2019-05-21 13:29 ` Cyril Hrubis
  2019-05-21 13:38   ` Jan Stancek
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2019-05-21 13:29 UTC (permalink / raw)
  To: ltp

Hi!
> 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.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH] overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures"
  2019-05-21 13:29 ` Cyril Hrubis
@ 2019-05-21 13:38   ` Jan Stancek
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2019-05-21 13:38 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> Hi!
> > 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.

> 
> --
> Cyril Hrubis
> chrubis@suse.cz
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-21 13:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21  8:25 [LTP] [PATCH] overcommit_memory: update for "mm: fix false-positive OVERCOMMIT_GUESS failures" Jan Stancek
2019-05-21 13:29 ` Cyril Hrubis
2019-05-21 13:38   ` Jan Stancek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.