On 09.08.2006 [15:55:52 -0500], Adam Litke wrote:
> On Wed, 2006-08-09 at 12:01 -0700, Nishanth Aravamudan wrote:
> > Description: Recalculate the number of free hugepages before using it
> > has a parameter in run_tests.sh. The number may change due to the
> > sharing tests or other things running in the system. This is to work
> > around both cases.
> > 
> > Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
> 
> How about something like the patch below which keeps the free hugepages
> code in one place?  Could you test this on your setup?

Acked-by: Nishanth Aravamudan <[EMAIL PROTECTED]>

if...

> diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> index 7231f9f..5095445 100755
> --- a/tests/run_tests.sh
> +++ b/tests/run_tests.sh
> @@ -7,10 +7,15 @@ unset HUGETLB_MORECORE
>  
>  ENV=/usr/bin/env
>  
> +function free_hpages() {
> +     H=$(grep 'HugePages_Free:' /proc/meminfo | cut -f2 -d:)
> +     [ -z "$H" ] && H=0
> +     echo "$H"
> +}
> +
> +

you only add one line of extra whitespace :)

Thanks,
Nish

>  TOTAL_HPAGES=$(grep 'HugePages_Total:' /proc/meminfo | cut -f2 -d:)
>  [ -z "$TOTAL_HPAGES" ] && TOTAL_HPAGES=0
> -FREE_HPAGES=$(grep 'HugePages_Free:' /proc/meminfo | cut -f2 -d:)
> -[ -z "$FREE_HPAGES" ] && FREE_HPAGES=0
>  HPAGE_SIZE=$(grep 'Hugepagesize:' /proc/meminfo | awk '{print $2}')
>  [ -z "$HPAGE_SIZE" ] && HPAGE_SIZE=0
>  HPAGE_SIZE=$(( $HPAGE_SIZE * 1024 ))
> @@ -104,7 +109,7 @@ functional_tests () {
>      run_test truncate
>      run_test shared
>      run_test mprotect
> -    run_test mlock $FREE_HPAGES
> +    run_test mlock `free_hpages`
>  
>  # Specific kernel bug tests
>      run_test ptrace-write-hugepage
> @@ -139,15 +144,17 @@ functional_tests () {
>  # alternatively, use
>  # killall -HUP hugetlbd
>  # to make the sharing daemon give up the files
> -    FREE_HPAGES=$(grep 'HugePages_Free:' /proc/meminfo | cut -f2 -d:)
> -    [ -z "$FREE_HPAGES" ] && FREE_HPAGES=0
> -    run_test chunk-overcommit $FREE_HPAGES
> -    run_test alloc-instantiate-race $FREE_HPAGES
> +    run_test chunk-overcommit `free_hpages`
> +    run_test alloc-instantiate-race `free_hpages`
>  }
>  
>  stress_tests () {
>      ITERATIONS=10           # Number of iterations for looping tests
> -    NRPAGES=$FREE_HPAGES
> +
> +    # Don't update NRPAGES every time like above because we want to catch the
> +    # failures that happen when the kernel doesn't release all of the huge 
> pages
> +    # after a stress test terminates
> +    NRPAGES=`free_hpages`
>  
>      run_test mmap-gettest ${ITERATIONS} ${NRPAGES}
>  
> 
> -- 
> Adam Litke - (agl at us.ibm.com)
> IBM Linux Technology Center
> 

-- 
Nishanth Aravamudan <[EMAIL PROTECTED]>
IBM Linux Technology Center

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to