public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Caspar Zhang <caspar@casparzhang.com>
To: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Cc: ltp-list@lists.sourceforge.net, bob.picco@oracle.com
Subject: Re: [LTP] [PATCH] max_map_count: corrected max_map_count condition
Date: Wed, 31 Jul 2013 11:03:02 +0800	[thread overview]
Message-ID: <51F87E66.2020004@casparzhang.com> (raw)
In-Reply-To: <1375192031-10636-1-git-send-email-stanislav.kholmanskikh@oracle.com>

On 07/30/2013 09:47 PM, Stanislav Kholmanskikh wrote:
> From: Stanislav kholmanskikh <stanislav.kholmanskikh@oracle.com>
>
> * kernel test for max_map_count_sysctl is:
>     /* Too many mappings? */
>     if (mm->map_count > sysctl_max_map_count)
>       return -ENOMEM;
>    so in LTP test map_count should be greater than max_map_count by 1
>
> * only [vsyscall] is allocated without incrementing mm->map_count
>
> Author: Bob Picco <bob.picco@oracle.com>
>
> Signed-off-by: Stanislav kholmanskikh <stanislav.kholmanskikh@oracle.com>

Acked-by: Caspar Zhang <caspar@casparzhang.com>

> ---
>   testcases/kernel/mem/tunable/max_map_count.c |   41 +++++++++++++++++--------
>   1 files changed, 28 insertions(+), 13 deletions(-)
>
> diff --git a/testcases/kernel/mem/tunable/max_map_count.c b/testcases/kernel/mem/tunable/max_map_count.c
> index e948868..01fbe5e 100644
> --- a/testcases/kernel/mem/tunable/max_map_count.c
> +++ b/testcases/kernel/mem/tunable/max_map_count.c
> @@ -14,20 +14,16 @@
>    * The program trys to invoke mmap() endless until triggering MAP_FAILED,
>    * then read the process's maps file /proc/[pid]/maps, save the line number
>    * to map_count variable, and compare it with /proc/sys/vm/max_map_count,
> - * map_count should less than max_map_count.
> - * Note: There are two special vmas VDSO and VSYSCALL, which are allocated
> - * via install_special_mapping(), install_specail_mapping() allows the VMAs
> - * to be allocated and inserted without checking the sysctl_map_map_count,
> - * and each /proc/<pid>/maps has both at the end:
> - * # cat /proc/self/maps
> + * map_count should be greater than max_map_count by 1;
> + *
> + * Note: On some architectures there is a special vma VSYSCALL, which
> + * is allocated without incrementing mm->map_count variable. On these
> + * architectures each /proc/<pid>/maps has at the end:
>    * ...
>    * ...
> - * 7fff7b9ff000-7fff7ba00000 r-xp 00000000 00:00 0           [vdso]
>    * ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0   [vsyscall]
>    *
> - * so during comparing with map_count and /proc/sys/vm/max_map_count,
> - * we should except the two special vmas from map_count:
> - * map_count -= 2;
> + * so we ignore this line during /proc/[pid]/maps reading.
>    *
>    * ********************************************************************
>    * Copyright (C) 2012 Red Hat, Inc.
> @@ -121,6 +117,21 @@ void cleanup(void)
>   	TEST_CLEANUP;
>   }
>
> +/* This is a filter to exclude map entries which aren't accounted
> + * for in the vm_area_struct's map_count.
> + */
> +#if defined(__x86_64__) || defined(__x86__)
> +static int filter_map(char *buf)
> +{
> +	return strcmp(buf, "[vsyscall]") == 0;
> +}
> +#else
> +static int filter_map(char *buf)
> +{
> +	return 0;
> +}
> +#endif
> +
>   static long count_maps(pid_t pid)
>   {
>   	FILE *fp;
> @@ -136,8 +147,7 @@ static long count_maps(pid_t pid)
>   	while (getline(&line, &len, fp) != -1) {
>   		/* exclude vdso and vsyscall */
>   		if (sscanf(line, "%*p-%*p %*4s %*p %*2d:%*2d %*d %s", buf) ==
> -		    1 && ((strcmp(buf, "[vdso]") == 0) ||
> -			  (strcmp(buf, "[vsyscall]") == 0)))
> +				1 && filter_map(buf))
>   			continue;
>   		map_count++;
>   	}
> @@ -202,7 +212,12 @@ static void max_map_count_test(void)
>   			tst_brkm(TBROK, cleanup, "child did not stopped");
>
>   		map_count = count_maps(pid);
> -		if (map_count == max_maps)
> +		/* Note max_maps will be exceeded by one for
> +		 * the sysctl setting of max_map_count. This
> +		 * is the mm failure point at the time of
> +		 * writing this COMMENT!
> +		*/
> +		if (map_count == (max_maps + 1))
>   			tst_resm(TPASS, "%ld map entries in total "
>   				 "as expected.", max_maps);
>   		else
>


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2013-07-31  3:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 13:47 [LTP] [PATCH] max_map_count: corrected max_map_count condition Stanislav Kholmanskikh
2013-07-31  3:03 ` Caspar Zhang [this message]
2013-08-05  3:16 ` Zhouping Liu
2013-08-06  7:08   ` Stanislav Kholmanskikh
2013-08-05 15:41 ` chrubis
     [not found]   ` <52009D26.4030609@oracle.com>
     [not found]     ` <520A34B4.3020502@oracle.com>
2013-08-13 14:52       ` chrubis
     [not found]       ` <520AFFFB.6040708@redhat.com>
     [not found]         ` <520B1666.6010808@oracle.com>
     [not found]           ` <520B3FC4.5020809@redhat.com>
2013-08-19  1:32             ` Wanlong Gao

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=51F87E66.2020004@casparzhang.com \
    --to=caspar@casparzhang.com \
    --cc=bob.picco@oracle.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=stanislav.kholmanskikh@oracle.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