+ selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: selftests/vm/run_vmtests: adjust hugetlb size according to nr_cpus
has been added to the -mm tree.  Its filename is
     selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Li Zhijian <zhijianx.li@xxxxxxxxx>
Subject: selftests/vm/run_vmtests: adjust hugetlb size according to nr_cpus

Fix userfaultfd_hugetlb on hosts which have more than 64 cpus.

---------------------------
running userfaultfd_hugetlb
---------------------------
invalid MiB
Usage: <MiB> <bounces>
[FAIL]

Via userfaultfd.c we can know, hugetlb_size needs to meet hugetlb_size >=
nr_cpus * hugepage_size.  hugepage_size is often 2M, so when host cpus >
64, it requires more than 128M.

Link: http://lkml.kernel.org/r/20180302024356.83359-1-zhijianx.li@xxxxxxxxx
Signed-off-by: Li Zhijian <zhijianx.li@xxxxxxxxx>
Cc: Shuah Khan <shuah@xxxxxxxxxx>
Cc: SeongJae Park <sj38.park@xxxxxxxxx>
Cc: Philippe Ombredanne <pombredanne@xxxxxxxx>
Cc: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 tools/testing/selftests/vm/run_vmtests |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff -puN tools/testing/selftests/vm/run_vmtests~selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus tools/testing/selftests/vm/run_vmtests
--- a/tools/testing/selftests/vm/run_vmtests~selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus
+++ a/tools/testing/selftests/vm/run_vmtests
@@ -2,8 +2,6 @@
 # SPDX-License-Identifier: GPL-2.0
 #please run as root
 
-#we need 256M, below is the size in kB
-needmem=262144
 mnt=./huge
 exitcode=0
 
@@ -17,6 +15,13 @@ while read name size unit; do
 	fi
 done < /proc/meminfo
 
+nr_cpus=$(nproc)
+pgsize_MB=$((pgsize/1024))
+# rule: nr_cpus * pgsize_MB <= hugetlb_size(round to 128M for testing)
+hugetlb_size=$((((nr_cpus*pgsize_MB+127)/128)*128))
+# needmem depends on the nr_cpus, below is the size in kB
+needmem=$((hugetlb_size*2*1024))
+
 #set proper nr_hugepages
 if [ -n "$freepgs" ] && [ -n "$pgsize" ]; then
 	nr_hugepgs=`cat /proc/sys/vm/nr_hugepages`
@@ -107,8 +112,8 @@ fi
 echo "---------------------------"
 echo "running userfaultfd_hugetlb"
 echo "---------------------------"
-# 256MB total huge pages == 128MB src and 128MB dst
-./userfaultfd hugetlb 128 32 $mnt/ufd_test_file
+# 256MB total huge pages == 128MB src and 128MB dst when nr_cpus <= 64
+./userfaultfd hugetlb $hugetlb_size 32 $mnt/ufd_test_file
 if [ $? -ne 0 ]; then
 	echo "[FAIL]"
 	exitcode=1
_

Patches currently in -mm which might be from zhijianx.li@xxxxxxxxx are

selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux