The patch titled Subject: selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus-v2 has been removed from the -mm tree. Its filename was selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus-v2.patch This patch was dropped because it was folded into selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus.patch ------------------------------------------------------ From: Li Zhijian <zhijianx.li@xxxxxxxxx> Subject: selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus-v2 Changes since v1: - update changelog/comments and variable name to make code more easier to read/understand(stolen from Mike Kravetz) Link: http://lkml.kernel.org/r/20180302024356.83359-1-zhijianx.li@xxxxxxxxx Link: http://lkml.kernel.org/r/20180303125027.81638-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> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/vm/run_vmtests | 26 +++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff -puN tools/testing/selftests/vm/run_vmtests~selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus-v2 tools/testing/selftests/vm/run_vmtests --- a/tools/testing/selftests/vm/run_vmtests~selftests-vm-run_vmtests-adjust-hugetlb-size-accroding-to-nr_cpus-v2 +++ a/tools/testing/selftests/vm/run_vmtests @@ -5,27 +5,30 @@ mnt=./huge exitcode=0 -#get pagesize and freepages from /proc/meminfo +#get huge pagesize and freepages from /proc/meminfo while read name size unit; do if [ "$name" = "HugePages_Free:" ]; then freepgs=$size fi if [ "$name" = "Hugepagesize:" ]; then - pgsize=$size + hpgsize_KB=$size fi done < /proc/meminfo +# Simple hugetlbfs tests have a hardcoded minimum requirement of +# huge pages totaling 256MB (262144KB) in size. The userfaultfd +# hugetlb test requires a minimum of 2 * nr_cpus huge pages. Take +# both of these requirements into account and attempt to increase +# number of huge pages available. 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)) +hpgsize_MB=$((hpgsize_KB / 1024)) +half_ufd_size_MB=$((((nr_cpus * hpgsize_MB + 127) / 128) * 128)) +needmem_KB=$((half_ufd_size_MB * 2 * 1024)) #set proper nr_hugepages -if [ -n "$freepgs" ] && [ -n "$pgsize" ]; then +if [ -n "$freepgs" ] && [ -n "$hpgsize_KB" ]; then nr_hugepgs=`cat /proc/sys/vm/nr_hugepages` - needpgs=`expr $needmem / $pgsize` + needpgs=$((needmem_KB / hpgsize_KB)) tries=2 while [ $tries -gt 0 ] && [ $freepgs -lt $needpgs ]; do lackpgs=$(( $needpgs - $freepgs )) @@ -112,8 +115,9 @@ fi echo "---------------------------" echo "running userfaultfd_hugetlb" echo "---------------------------" -# 256MB total huge pages == 128MB src and 128MB dst when nr_cpus <= 64 -./userfaultfd hugetlb $hugetlb_size 32 $mnt/ufd_test_file +# Test requires source and destination huge pages. Size of source +# (half_ufd_size_MB) is passed as argument to test. +./userfaultfd hugetlb $half_ufd_size_MB 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