Skip to contentSkip to conversation

Per-NUMA control of huge pages

PATCH In review Han Pingtian 2 participants 3 messages Mar 9, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 testcases/kernel/numa/numa01.sh |   64 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 63 insertions(+), 1 deletions(-)
testcases/kernel/numa/numa01.sh +63 -1
index 151d25b..4e58c66 100644
@@ -834,6 +834,68 @@ 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_path="/sys/devices/system/node/node\$COUNTER/hugepages/${Hugepage_root##*/}/nr_hugepages"
+
+    COUNTER=0
+    while [ $COUNTER -lt $max_node ];do
+	Old_nr_hugepages=$(eval cat $Node_nr_hugepages_path)
+	numactl -m $COUNTER echo $[Nr_hugepages+1] > $Hugepage_root/nr_hugepages_mempolicy
+	New_nr_hugepages=$(eval cat $Node_nr_hugepages_path)
+
+	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=$(eval cat $Node_nr_hugepages_path)
+
+	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] > $(eval echo $Node_nr_hugepages_path)
+	New_nr_hugepages=$(eval cat $Node_nr_hugepages_path)
+
+	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] > $(eval echo $Node_nr_hugepages_path)
+	New_nr_hugepages=$(eval cat $Node_nr_hugepages_path)
+
+	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 +905,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
 
Signature · 11 lines
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
#1 lore raw
Quoted 5 lines · Han Pingtian

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.
Thanks,
-Garrett

------------------------------------------------------------------------------
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

#2 lore raw
Quoted 8 lines · Garrett Cooper
Quoted 5 lines · Han Pingtian

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.

Quoted 2 lines

Thanks,
-Garrett

Signature · 5 lines
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 '{$..#..}'.

---
 testcases/kernel/numa/numa01.sh |   65 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 1 deletions(-)
testcases/kernel/numa/numa01.sh +64 -1
index 151d25b..3ff871a 100644
@@ -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
 
Signature · 1 line
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