On Fri, 2008-11-07 at 15:17 +0000, Eric B Munson wrote:
> Having overcommit pages makes the heap-overflow test fail, this patch
> uses the function introduces earlier to set the overcommit pool to 0.
> This forces this test to be run as root only.
> 
> Signed-off-by: Eric B Munson <[EMAIL PROTECTED]>

Did you test this on a kernel with no hugetlb overcommit support?

> ---
>  tests/heap-overflow.c |   16 +++++++++++++++-
>  1 files changed, 15 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/heap-overflow.c b/tests/heap-overflow.c
> index 0f1029c..b351750 100644
> --- a/tests/heap-overflow.c
> +++ b/tests/heap-overflow.c
> @@ -26,9 +26,17 @@
>  #include <hugetlbfs.h>
>  #include "hugetests.h"
> 
> +long pool_size = -1;
> +long hpagesize;
> +
> +void cleanup(void)
> +{
> +     if (pool_size >= 0)
> +             restore_overcommit_pages(hpagesize, pool_size);
> +}
> +
>  int main(int argc, char **argv)
>  {
> -     long hpagesize;
>       int freepages;
>       long size1, size2;
>       void *p1, *p2;
> @@ -41,6 +49,12 @@ int main(int argc, char **argv)
> 
>       hpagesize = check_hugepagesize();
> 
> +     /* Must be root because this test modifies the overcommit pool */
> +     check_must_be_root();
> +
> +     pool_size = save_overcommit_pages(hpagesize);
> +     set_nr_overcommit_hugepages(hpagesize, 0);
> +
>       freepages = get_huge_page_counter(hpagesize, HUGEPAGES_FREE);
>       if (freepages < 3)
>               CONFIG("Must have at least 3 free hugepages");
-- 
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to