[linux] 15/17: selftests: vm: Try harder to allocate huge pages

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Sat Oct 31 22:18:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository linux.

commit a29879587ad084ecfbdaa82319d790e73cb01b2c
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Fri Oct 30 10:26:49 2015 +0000

    selftests: vm: Try harder to allocate huge pages
---
 ...ests-vm-try-harder-to-allocate-huge-pages.patch | 40 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 41 insertions(+)

diff --git a/debian/patches/bugfix/all/selftests-vm-try-harder-to-allocate-huge-pages.patch b/debian/patches/bugfix/all/selftests-vm-try-harder-to-allocate-huge-pages.patch
new file mode 100644
index 0000000..e5a9d96
--- /dev/null
+++ b/debian/patches/bugfix/all/selftests-vm-try-harder-to-allocate-huge-pages.patch
@@ -0,0 +1,40 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Sat, 31 Oct 2015 17:56:11 +0000
+Subject: selftests: vm: Try harder to allocate huge pages
+
+If we need to increase the number of huge pages, drop caches first
+to reduce fragmentation and then check that we actually allocated
+as many as we wanted.  Retry once if that doesn't work.
+
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+--- a/tools/testing/selftests/vm/run_vmtests
++++ b/tools/testing/selftests/vm/run_vmtests
+@@ -20,13 +20,26 @@ done < /proc/meminfo
+ if [ -n "$freepgs" ] && [ -n "$pgsize" ]; then
+ 	nr_hugepgs=`cat /proc/sys/vm/nr_hugepages`
+ 	needpgs=`expr $needmem / $pgsize`
+-	if [ $freepgs -lt $needpgs ]; then
++	tries=2
++	while [ $tries -gt 0 ] && [ $freepgs -lt $needpgs ]; do
+ 		lackpgs=$(( $needpgs - $freepgs ))
++		echo 3 > /proc/sys/vm/drop_caches
+ 		echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages
+ 		if [ $? -ne 0 ]; then
+ 			echo "Please run this test as root"
+ 			exit 1
+ 		fi
++		while read name size unit; do
++			if [ "$name" = "HugePages_Free:" ]; then
++				freepgs=$size
++			fi
++		done < /proc/meminfo
++		tries=$((tries - 1))
++	done
++	if [ $freepgs -lt $needpgs ]; then
++		printf "Not enough huge pages available (%d < %d)\n" \
++		       $freepgs $needpgs
++		exit 1
+ 	fi
+ else
+ 	echo "no hugetlbfs support in kernel?"
diff --git a/debian/patches/series b/debian/patches/series
index 5f18c07..3bb6d83 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -86,3 +86,4 @@ bugfix/all/selftests-add-missing-include-directives.patch
 bugfix/all/selftests-memfd-stop-unnecessary-rebuilds.patch
 bugfix/all/selftests-kprobe-choose-an-always-defined-function-t.patch
 bugfix/all/selftests-make-scripts-executable.patch
+bugfix/all/selftests-vm-try-harder-to-allocate-huge-pages.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list