From: Shuang Qiu <shuang.qiu@oracle.com>
To: Zhouping Liu <zliu@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] Set tunable value of min_free_kbytes lower
Date: Tue, 28 Aug 2012 11:11:08 +0800 [thread overview]
Message-ID: <503C36CC.20201@oracle.com> (raw)
In-Reply-To: <1768335107.59483055.1346044605729.JavaMail.root@redhat.com>
On 08/27/2012 01:16 PM, Zhouping Liu wrote:
>
> ----- Original Message -----
> For the issue that min_free_kbytes caused system hang, I prepared a patch for it,
> at the same time, in order to enlarge the case's coverage, I add a new case(2x default_tune)
> I have tested it in my box, it's good.
>
> Shuang, can you review and test the patch?
>
> diff --git a/testcases/kernel/mem/tunable/min_free_kbytes.c b/testcases/kernel/mem/tunable/min_free_kbytes.c
> index 00ead04..ded0e45 100644
> --- a/testcases/kernel/mem/tunable/min_free_kbytes.c
> +++ b/testcases/kernel/mem/tunable/min_free_kbytes.c
> @@ -10,7 +10,8 @@
> * the current free memory with the tunable value repeatedly.
> *
> * a) default min_free_kbytes with all overcommit memory policy
> - * b) half of mem_free with all overcommit memory policy
> + * b) 2x default value with all overcommit memory policy
> + * c) 10% of MemFree or %5 MemTotal with all overcommit memory policy
> *
> ********************************************************************
> * Copyright (C) 2012 Red Hat, Inc.
> @@ -115,20 +116,27 @@ int main(int argc, char *argv[])
> static void test_tune(unsigned long overcommit_policy)
> {
> int status;
> - int pid[2];
> + int pid[3];
> int ret, i;
> - unsigned long tune, memfree;
> + unsigned long tune, memfree, memtotal;
>
> set_sys_tune("overcommit_memory", overcommit_policy, 1);
>
> - for (i = 0; i < 2; i++) {
> + for (i = 0; i < 3; i++) {
> /* case1 */
> if (i == 0)
> set_sys_tune("min_free_kbytes", default_tune, 1);
> /* case2 */
> - else {
> + else if (i == 1) {
> + set_sys_tune("min_free_kbytes", 2 * default_tune, 1);
> + /* case3 */
> + } else {
> memfree = read_meminfo("MemFree:");
> - tune = memfree / 2;
> + memtotal = read_meminfo("MemTotal:");
> + tune = memfree / 10;
> + if (tune > (memtotal / 20))
> + tune = memtotal / 20;
> +
> set_sys_tune("min_free_kbytes", tune, 1);
> }
>
Hi Zhouping,
I have tested this patch,it works.
But I found another problem with this case that it is not work
expectedly with the scenario that i386 system(PAE kernel) which has >4GB
memory.
i.e. In i386 system with 7GB free memory,it could only eat about 3GB
memory in one mem-hog fork process.
And we can also patch the overflow issue which I mentioned before:
The type of total_mem "unsigned long" is not suitable with nowadays
memory ,it will overflow(with i386) in line 177:map_count = total_mem
*
KB / MAP_SIZE and the value of map_count is not correct.
Using "unsigned long long" could fix this issue.
Thanks
Shuang
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2012-08-28 3:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 6:43 [LTP] [PATCH] Set tunable value of min_free_kbytes lower shuang.qiu
2012-08-23 8:59 ` Zhouping Liu
2012-08-23 9:00 ` Wanlong Gao
2012-08-24 8:11 ` Zhouping Liu
2012-08-24 10:18 ` Shuang Qiu
2012-08-24 13:48 ` Zhouping Liu
2012-08-27 3:03 ` Shuang Qiu
2012-08-27 5:01 ` Zhouping Liu
2012-08-27 5:16 ` Zhouping Liu
2012-08-28 3:11 ` Shuang Qiu [this message]
2012-08-28 12:51 ` ZhouPing Liu
2012-08-29 8:08 ` Shuang Qiu
2012-08-29 8:29 ` Wanlong Gao
2012-08-29 8:56 ` Zhouping Liu
2012-08-29 14:03 ` Zhouping Liu
2012-08-30 2:53 ` Shuang Qiu
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=503C36CC.20201@oracle.com \
--to=shuang.qiu@oracle.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=zliu@redhat.com \
/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