History log of /external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f28b29f16ba7687795c77c423cea1afed8582fd9 18-Jul-2017 Li Wang <liwang@redhat.com> mem/tunable: convert to new API

Signed-off-by: Li Wang <liwang@redhat.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
a14f756d5890cee192f1cffe403b7607074a9b72 23-May-2017 Cyril Hrubis <chrubis@suse.cz> Unify MIN()/MAX() implementation + cleanup

The oldlib tests had defined MIN() and MAX() macros via <sys/param.h>
that was included from usctest.h that is included from test.h.

This patch adds tst_minmax.h that has safer versions of these macros
(expressions passed to the macros are evaluated only once) which is
then included from both tst_test.h and test.h.

Some of the testcases were relying on the usctest.h to include
sys/param.h or indirecly include limits.h which is included from
sys/param.h. This patch fixes such tests to include respective headers
directly.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
3a54f6b00a9b732699c892bf274c80666c8457a5 02-Sep-2016 Cui Bixuan <cuibixuan@huawei.com> overcommit_memory: fix spelling mistake

Fix spelling mistake for 'CommmitLimit'.

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
d1e794d62b1bf619df8390535e4c2a58899b1145 30-Jul-2015 Cyril Hrubis <chrubis@suse.cz> lib: Get rid of unused tst_require_root() callback

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
2987c680e1216bea110c0ad9bcc97b0d36e3f419 01-Apr-2015 Cyril Hrubis <chrubis@suse.cz> tunable/overcommit_memory: Set RLIMIT_AS to INFINITY

This fixes failures on machines where RLIMIT_AS is set lower than
two times of available memory, which caused the large allocations fails
with ENOMEM (found on SLES11 SP3 with 20GB RAM).

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
d6d11d08678aac1ed2c370ea8e42e5f45aea07be 09-Mar-2015 Cyril Hrubis <chrubis@suse.cz> Introduce tst_parse_opts()

The pattern that was used in all testcases is:

const char *msg;

msg = parse_opts(...);
if (msg)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);

This change simplifies the steps to just calling:

tst_parse_opts(...);

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
aabb8340f63ed31afe995fd97795e542dc68b93c 04-Feb-2015 Cyril Hrubis <chrubis@suse.cz> Include usctest.h in test.h

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
605fa3362fd7cef0baa2131be32cf44661783d3e 04-Feb-2015 Cyril Hrubis <chrubis@suse.cz> Get rid of TEST_CLEANUP

Special thanks to Coccinelle for making this easy job.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
0b9589f3f9c0345b29cfcf7da5a1253c708303eb 27-May-2014 Cyril Hrubis <chrubis@suse.cz> testcases: Constify char *msg variable.

The parse_opts() now returns const char * instead of char * this commit
fixes all warnings caused by the change.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
d59a659cd639ca2780b00049d102acd2a783d585 07-Mar-2013 Caspar Zhang <caspar@casparzhang.com> s/Tst_count/tst_count/ to avoid CamelCase

when using latest checkpatch.pl, CamelCase variables are not encouraged,
this patch does a batch update to replace all var `Tst_count` with
`tst_count`.

Signed-off-by: Caspar Zhang <caspar@casparzhang.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
79667facbd7a489bad97dcda1e2d319ee2a7a70e 12-Mar-2012 Caspar Zhang <caspar@casparzhang.com> mm: cleanup headers

This patch does some clean-ups under mem/ dir:

1) change #include "../include/mem.h" to #include "mem.h"
2) sort all headers properly

Signed-off-by: Caspar Zhang <caspar@casparzhang.com>
Tested-by: Caspar Zhang <caspar@casparzhang.com>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
52a8a6de2a72d2fbab6f7f3cd5100201bb046f49 21-Feb-2012 Wanlong Gao <gaowanlong@cn.fujitsu.com> mem/tunable: fix the overcommitting possible failure

1. CommitLimit may be changed when set another overcommit_memory
value.
2. Test overcommit_memory=2 first to avoid the condition
committed > CommitLimited.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Tested-by: Caspar Zhang <caspar@casparzhang.com>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c
c9f2fd5435fb4c4d5578a0feae71f753dead8c9b 13-Feb-2012 Zhouping Liu <zliu@redhat.com> mem/tunable: new testcase about overcommiting memory

There are two tunables overcommit_memory and overcommit_ratio under
/proc/sys/vm/, which can control memory overcommitment.

The overcommit_memory contains a flag that enables memory
overcommitment, it has three values:
- When this flag is 0, the kernel attempts to estimate the amount
of free memory left when userspace requests more memory.
- When this flag is 1, the kernel pretends there is always enough
memory until it actually runs out.
- When this flag is 2, the kernel uses a "never overcommit" policy
that attempts to prevent any overcommit of memory.

The overcommit_ratio tunable defines the amount by which the kernel
overextends its memory resources in the event that overcommit_memory
is set to the value of 2. The value in this file represents a
percentage added to the amount of actual RAM in a system when
considering whether to grant a particular memory request.
The general formula for this tunable is:
CommitLimit = SwapTotal + MemTotal * overcommit_ratio
CommitLimit, SwapTotal and MemTotal can read from /proc/meminfo.

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:
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

When overcommit_memory = 1, it can alloc enough much memory, I
choose the three cases:
a. less than sum_total: sum_total / 2, alloc should pass
b. equal to sum_total: sum_total, alloc should pass
c. greater than sum_total: sum_total * 2, alloc should pass
*note: sum_total = SwapTotal + MemTotal

When overcommit_memory = 2, the total virtual address space on
the system is limited to CommitLimit(Swap+RAM*overcommit_ratio)
commit_left(allocatable memory) = CommitLimit - Committed_AS
a. less than commit_left: commit_left / 2, alloc should pass
b. greater than commit_left: commit_left * 2, alloc should fail
c. overcommit limit: CommitLimit, alloc should fail
*note: CommitLimit is the current overcommit limit.
Committed_AS is the amount of memory that system has used.
it couldn't choose 'equal to commit_left' as a case, because
commit_left rely on Committed_AS, but the Committed_AS is not stable.

References:
- Documentation/sysctl/vm.txt
- Documentation/vm/overcommit-accounting

Signed-off-by: Zhouping Liu <zliu@redhat.com>
Acked-by: Caspar Zhang <caspar@casparzhang.com>
/external/ltp/testcases/kernel/mem/tunable/overcommit_memory.c