Hi, Cyril and all can anyone comment for the patch? Thanks, Zhouping
----- Original Message ----- > From: "Zhouping Liu" <[email protected]> > To: [email protected] > Cc: [email protected], [email protected] > Sent: Saturday, September 10, 2011 1:18:54 AM > Subject: [LTP][PATCH v5 2/2] mem/tunable: new testcase about overcommiting > memory > > hi, Cyril > v4 -> v5: delete the useless code: tst_exit(). > please comment it. > > 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. equal to free_total: free_total, alloc should pass. > c. greater than free_total: free_total * 2, 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, > allocatable memory = CommitLimit - Committed_As > I define it as commit_left, also I choose three cases: > 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. > why I din't choose 'equal to commit_left' as a case, because in > this case, the result is not fixed after I tested some times. > > References: > - Documentation/sysctl/vm.txt > - Documentation/vm/overcommit-accounting > > Signed-off-by: Zhouping Liu <[email protected]> > --- > runtest/mm | 7 + > testcases/kernel/mem/tunable/Makefile | 42 ++++ > testcases/kernel/mem/tunable/overcommit_memory.c | 278 > ++++++++++++++++++++++ > 3 files changed, 327 insertions(+), 0 deletions(-) > create mode 100644 testcases/kernel/mem/tunable/Makefile > create mode 100644 testcases/kernel/mem/tunable/overcommit_memory.c > > -- > Thanks, > Zhouping Liu > ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
