public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] madvise/madvise02.c: extend EINVAL test for MADV_MERGEABLE and MADV_UNMERGEABLE advice
Date: Tue, 25 Feb 2014 11:22:26 +0800	[thread overview]
Message-ID: <530C0C72.6090900@cn.fujitsu.com> (raw)
In-Reply-To: <1389867964-8072-1-git-send-email-wangxg.fnst@cn.fujitsu.com>

Hi,
 
Please ignore this patch. I do something wrong, thanks.

Regards,
Xiaoguang Wang


On 02/25/2014 11:09 AM, Xiaoguang Wang wrote:
> From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
>
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
>  testcases/kernel/syscalls/madvise/madvise02.c | 38 ++++++++++++++++++++++++---
>  1 file changed, 34 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/madvise/madvise02.c b/testcases/kernel/syscalls/madvise/madvise02.c
> index e7f4656..08ed717 100644
> --- a/testcases/kernel/syscalls/madvise/madvise02.c
> +++ b/testcases/kernel/syscalls/madvise/madvise02.c
> @@ -27,6 +27,8 @@
>   *  2. advice is not a valid value
>   *  3. application is attempting to release
>   *     locked or shared pages (with MADV_DONTNEED)
> + *  4. MADV_MERGEABLE or MADV_UNMERGEABLE was specified in advice,
> + *     but kernel was not configured with CONFIG_KSM
>   *
>   * (B) Test Case for ENOMEM
>   *  4. addresses in the specified range are not currently mapped
> @@ -52,9 +54,14 @@
>  #include "usctest.h"
>  
>  #define MM_RLIMIT_RSS 5
> +/*
> + * when kernel is 2.6.32 or newer and /sys/kernel/mm/ksm is exist,
> + * we think kernel was configured with CONFIG_KSM.
> + */
> +#define KSM_SYS_DIR	"/sys/kernel/mm/ksm"
>  
>  char *TCID = "madvise02";
> -int TST_TOTAL = 7;
> +int TST_TOTAL = 8;
>  
>  static void setup(void);
>  static void cleanup(void);
> @@ -128,11 +135,34 @@ int main(int argc, char *argv[])
>  		TEST(madvise(file, stat.st_size, MADV_DONTNEED));
>  		check_and_print(EINVAL);
>  
> -		if (munmap(file, stat.st_size) == -1)
> -			tst_brkm(TBROK | TERRNO, cleanup, "munmap failed");
>  #endif /* if !defined(UCLINUX) */
>  
> +#if defined(MADV_MERGEABLE) && defined(MADV_UNMERGEABLE)
>  		/* Test Case 4 */
> +		if (tst_kvercmp(2, 6, 32) < 0) {
> +			tst_resm(TCONF, "kernel samepage merging (KSM) needs "
> +				 "2.6.32 or higher, skip EINVAL test for "
> +				 "MADV_MERGEABLE and MADV_UNMERGEABLE.");
> +		} else {
> +			if (access(KSM_SYS_DIR, F_OK) < 0) {
> +				tst_resm(TINFO, "kernel was not configured "
> +					 "with CONFIG_KSM");
> +
> +				TEST(madvise(file, stat.st_size,
> +				     MADV_MERGEABLE));
> +				check_and_print(EINVAL);
> +
> +				TEST(madvise(file, stat.st_size,
> +				     MADV_UNMERGEABLE));
> +				check_and_print(EINVAL);
> +			}
> +		}
> +#endif
> +
> +		if (munmap(file, stat.st_size) == -1)
> +			tst_brkm(TBROK | TERRNO, cleanup, "munmap failed");
> +
> +		/* Test Case 5 */
>  
>  		/* We cannot be sure, which region is mapped, which is
>  		 * not, at runtime.
> @@ -169,7 +199,7 @@ int main(int argc, char *argv[])
>  		TEST(madvise(low, len, MADV_NORMAL));
>  		check_and_print(ENOMEM);
>  
> -		/* Test Case 5 */
> +		/* Test Case 6 */
>  		/* Unmap the file map from low */
>  		if (munmap(low, stat.st_size / 2) < 0)
>  			tst_brkm(TBROK | TERRNO, cleanup,


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      reply	other threads:[~2014-02-25  3:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16 10:26 [LTP] [PATCH] madvise/madvise02.c: extend EINVAL test for MADV_MERGEABLE and MADV_UNMERGEABLE advice Xiaoguang Wang
2014-02-25  3:22 ` Xiaoguang Wang [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=530C0C72.6090900@cn.fujitsu.com \
    --to=wangxg.fnst@cn.fujitsu.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