public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Zhouping Liu <zliu@redhat.com>
To: madhura <madhura@linux.vnet.ibm.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] max_map_count: Fails due to negative memfree value
Date: Thu, 17 Jan 2013 08:34:32 -0500 (EST)	[thread overview]
Message-ID: <147078656.7580859.1358429672135.JavaMail.root@redhat.com> (raw)
In-Reply-To: <50F7E521.5050204@linux.vnet.ibm.com>



----- Original Message -----
> From: "madhura" <madhura@linux.vnet.ibm.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Thursday, January 17, 2013 7:48:49 PM
> Subject: [LTP]  [PATCH] max_map_count: Fails due to negative memfree value
> 
> In situations when memory is occupied to a certain higher limit by
> system processes, the amount of memory available may be in
> negative/low values not suitable for testing.
> Hence its better to have a memory check prior to the test beginning.
> 
> Signed-off-by: Madhura P S <madhura@linux.vnet.ibm.com>
> 
> ---
> ltp-full-20130109/testcases/kernel/mem/tunable/max_map_count.c.org
> 	2013-01-17 17:15:38.957032558 +0530
> +++ ltp-full-20130109/testcases/kernel/mem/tunable/max_map_count.c
> 	2013-01-17 17:16:58.092909326 +0530
> @@ -152,7 +152,7 @@ static void max_map_count_test(void)
>   	pid_t pid;
>   	long max_maps;
>   	long map_count;
> -	long max_iters;
> +	long max_iters = 0;
>   	long memfree;
>   
>   	/*
> @@ -174,7 +174,8 @@ static void max_map_count_test(void)
>   	 */
>   	memfree = read_meminfo("CommitLimit:") -
>   	read_meminfo("Committed_AS:");
>   	/* 64 used as a bias to make sure no overflow happen */
> -	max_iters = memfree / sysconf(_SC_PAGESIZE) * 1024 - 64;
> +	if (memfree > 0)
> +		max_iters = memfree / sysconf(_SC_PAGESIZE) * 1024 - 64;

Generally, the situation (CommitLimit < Committed_AS) can't be hit,
IMO, if yes, that means your system has been some broken(I suppose it's kernel's issue)

so you should here add the below lines to catch the exception:

        else {
               tst_resm(TINFO, "CommmitLimit is %ld, Committed_AS"
                        " is %ld", commit_limit, committed);
               tst_brkm(TBROK, cleanup, "Unexpected error: "
                        "CommitLimit < Committed_AS");
        }

-- 
Thanks,
Zhouping

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      reply	other threads:[~2013-01-17 13:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17 11:48 [LTP] [PATCH] max_map_count: Fails due to negative memfree value madhura
2013-01-17 13:34 ` Zhouping Liu [this message]

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=147078656.7580859.1358429672135.JavaMail.root@redhat.com \
    --to=zliu@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=madhura@linux.vnet.ibm.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