On Tue, Mar 08, 2011 at 07:46:39PM -0800, Garrett Cooper wrote:
> On Tue, Mar 8, 2011 at 7:37 PM, Han Pingtian <[email protected]> wrote:
> > There are two new features of hugetlb related to NUMA:
> > Interaction of Task Memory Policy with Huge Page Allocation/Freeing and
> > Per Node Hugepages Attributes. Please refer to
> > Documentation/vm/hugetlbpage.txt in kernel source for details. This
> > patch try to verify those two features in numa's test.
> 
> Use portable shell please.
I have updated it according to your suggestion. Please review. Thanks.
> Thanks,
> -Garrett

-- 
Han Pingtian
Quality Engineer
hpt @ #kernel-qe
Red Hat, Inc
Freedom ... courage ... Commitment ... ACCOUNTABILITY
>From d078e763b33f1bd069f1ff469956c44be549d204 Mon Sep 17 00:00:00 2001
From: Han Pingtian <[email protected]>
Date: Tue, 8 Mar 2011 14:27:05 +0800
Subject: [PATCH] Per-NUMA control of huge pages

There are two new features of hugetlb related to NUMA:
Interaction of Task Memory Policy with Huge Page Allocation/Freeing and
Per Node Hugepages Attributes. Please refer to
Documentation/vm/hugetlbpage.txt in kernel source for details. This
patch try to verify those two features in numa's test.

v1->v2: avoid using 'eval' and '{$..#..}'.

Signed-off-by: Han Pingtian <[email protected]>
---
 testcases/kernel/numa/numa01.sh |   65 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/numa/numa01.sh b/testcases/kernel/numa/numa01.sh
index 151d25b..3ff871a 100644
--- a/testcases/kernel/numa/numa01.sh
+++ b/testcases/kernel/numa/numa01.sh
@@ -834,6 +834,69 @@ test010()
     tst_resm TPASS "NUMA MIGRATEPAGES policy -TEST10 PASSED !!"
     return 0
 }
+# Function:     test11
+#
+# Description:  - Verification of Interaction of Task Memory Policy with Huge 
Page Allocation/Freeing
+#
+# Return:       - zero on success.
+#               - non-zero on failure.
+test011()
+{
+    TCID=numa11
+    TST_COUNT=11
+
+    Hugepage_root=$(echo /sys/kernel/mm/hugepages/hugepages-*|tail -n1)
+    Nr_hugepages=$(cat $Hugepage_root/nr_hugepages)
+    Node_nr_hugepages_root="/sys/devices/system/node/node"
+    Node_nr_hugepages="/hugepages/$(echo $Hugepage_root | awk -F'/' '{print 
$NF}')/nr_hugepages"
+
+    COUNTER=0
+    while [ $COUNTER -lt $max_node ];do
+       Old_nr_hugepages=$(cat 
$Node_nr_hugepages_root$COUNTER/$Node_nr_hugepages)
+       numactl -m $COUNTER echo $[Nr_hugepages+1] > 
$Hugepage_root/nr_hugepages_mempolicy
+       New_nr_hugepages=$(cat 
$Node_nr_hugepages_root$COUNTER/$Node_nr_hugepages)
+
+       if [ $[Old_nr_hugepages+1] -ne $New_nr_hugepages ]
+       then
+           tst_resm TFAIL \
+               "Teset #11: NUMA allocate huge page through Memory Policy 
failed on node #$COUNTER"
+           return 1
+       fi
+
+       numactl -m $COUNTER echo 1 > $Hugepage_root/nr_hugepages_mempolicy
+       New_nr_hugepages=$(cat 
$Node_nr_hugepages_root$COUNTER/$Node_nr_hugepages)
+
+       if [ $Old_nr_hugepages -ne $New_nr_hugepages ]
+       then
+           tst_resm TFAIL \
+               "Test #11: NUMA free huge page through Memory Policy failed on 
node #$COUNTER"
+           return 1
+       fi
+
+       echo $[Old_nr_hugepages+1] > 
$Node_nr_hugepages_root$COUNTER/$Node_nr_hugepages
+       New_nr_hugepages=$(cat 
$Node_nr_hugepages_root$COUNTER/$Node_nr_hugepages)
+
+       if [ $[Old_nr_hugepages+1] -ne $New_nr_hugepages ]
+       then
+           tst_resm TFAIL \
+               "Test #11: NUMA per node hugepages allocation failed on node 
#$COUNTER"
+           return 1
+       fi
+
+       echo $[New_nr_hugepages-1] > 
$Node_nr_hugepages_root$COUNTER/$Node_nr_hugepages
+       New_nr_hugepages=$(cat 
$Node_nr_hugepages_root$COUNTER/$Node_nr_hugepages)
+
+       if [ $Old_nr_hugepages -ne $New_nr_hugepages ]
+       then
+           tst_resm TFAIL \
+               "Test #11: NUMA per node hugepages freeing failed on node 
#$COUNTER"
+           return 1
+       fi
+
+       COUNTER=$[COUNTER+1]
+    done
+    tst_resm TPASS "NUMA Interact with Huge Page Allocation/Freeing -TEST11 
PASSED !!"
+}
 
 # Function:    main
 #
@@ -843,7 +906,7 @@ test010()
 #              - non-zero on failure.
     #WARNING!! Never use duplicate variables here...
     TCID=numa
-    no_of_test=10      #total no. of testcases
+    no_of_test=11      #total no. of testcases
     no_of_test_failed=0        #total no. of testcases failed
     numa_ret=0         #return value of main script
 
-- 
1.7.1

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to