From: Caspar Zhang <caspar@casparzhang.com>
To: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v6 2/2] mem/tunable: new testcase about overcommiting memory
Date: Thu, 22 Dec 2011 15:51:29 +0800 [thread overview]
Message-ID: <4EF2E181.4040500@casparzhang.com> (raw)
In-Reply-To: <dd4c6a9b-e905-427d-9a08-a63d96d66983@zmail13.collab.prod.int.phx2.redhat.com>
On 11/15/2011 09:19 PM, Zhouping Liu wrote:
> hi, Cyril & Garrett
>
> please feel free to comment the patch.
>
> 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 <zliu@redhat.com>
Reviewed-by: Caspar Zhang <caspar@casparzhang.com>
> ---
> testcases/kernel/mem/tunable/Makefile | 42 ++++
> testcases/kernel/mem/tunable/overcommit_memory.c | 278 ++++++++++++++++++++++
> 2 files changed, 320 insertions(+), 0 deletions(-)
> create mode 100644 testcases/kernel/mem/tunable/Makefile
> create mode 100644 testcases/kernel/mem/tunable/overcommit_memory.c
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
parent reply other threads:[~2011-12-22 8:16 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <dd4c6a9b-e905-427d-9a08-a63d96d66983@zmail13.collab.prod.int.phx2.redhat.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EF2E181.4040500@casparzhang.com \
--to=caspar@casparzhang.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox