From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E73C6FA3741 for ; Fri, 28 Oct 2022 13:27:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6879D6B0072; Fri, 28 Oct 2022 09:27:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 638D96B0073; Fri, 28 Oct 2022 09:27:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FF1B6B0074; Fri, 28 Oct 2022 09:27:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 410846B0072 for ; Fri, 28 Oct 2022 09:27:01 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BD96AA808C for ; Fri, 28 Oct 2022 13:27:00 +0000 (UTC) X-FDA: 80070433800.04.4FD9170 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 2D89240045 for ; Fri, 28 Oct 2022 13:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666963619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nMEqJ+SJX81wA4F4D8VcQ1oWVGj7/HJA80MojM8MPSQ=; b=Txwkx/3QgMEfCouQ6A8W9Wh+PTr2AYsEVZtRGV0mfhDFiBCMS9MpLOAEu7r8ZS5y0bRtpB 5SXuKAYMoE7ZH8gFkoVY1IX3mk6vnq0EsEFVYDCIPx8i2Q+ddJMzYZPOuJSx2LXkpz9EYN fccZGHEtdWhopRTZKVMHDriGWvDGcd8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-170-eXGXvRW4NzCQ6fMIzMAqUA-1; Fri, 28 Oct 2022 09:26:56 -0400 X-MC-Unique: eXGXvRW4NzCQ6fMIzMAqUA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DDD8484ACA0; Fri, 28 Oct 2022 13:26:55 +0000 (UTC) Received: from jsavitz-csb.redhat.com (unknown [10.22.16.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F9CE492B06; Fri, 28 Oct 2022 13:26:53 +0000 (UTC) From: Joel Savitz To: linux-kernel@vger.kernel.org Cc: Joel Savitz , Andrew Morton , Shuah Khan , David Hildenbrand , Nico Pache , linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: [PATCH linux-next] selftests/vm: calculate variables in correct order Date: Fri, 28 Oct 2022 09:26:40 -0400 Message-Id: <20221028132640.2791026-1-jsavitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666963620; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=nMEqJ+SJX81wA4F4D8VcQ1oWVGj7/HJA80MojM8MPSQ=; b=zFYxICohNe8sO4zy0yyXf5Pr9oSW/F6pp2HIMainyMOnEUTSqeZZ3xNdOd30fDpgDr6jaq RppEV7yO8h3HUO0pC75GSF10ACAWUrfNdSmgCUZR3bxHjFWHiFanEjY1J5Iyu0qvNyG0Gx vXWK33MTCMlDPlVFXdqhu9yk4VF9Tvk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Txwkx/3Q"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of jsavitz@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=jsavitz@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666963620; a=rsa-sha256; cv=none; b=VIuCr7Ys6E2mKItSIJZC1p5dxKvT0uwUoPwuI/ZxVUVePjoy4wY6qcGWKHMRwqB9ocXrhV ACSLA1Ghrfp0dqvKZ5too4Y2KsKzn71zzcT/E4Wk5/0OBeksGL9zuaECM2BOGtRwrbJgLA 8wHj/q1EHEbRWCcGHxaGb/KfLB7oXqg= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2D89240045 X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Txwkx/3Q"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of jsavitz@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=jsavitz@redhat.com X-Stat-Signature: a5jiowmgmea19cp8qi5wphueeb73iij1 X-HE-Tag: 1666963620-944565 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: commit b5ba705c2608 ("selftests/vm: enable running select groups of tests") unintentionally reversed the ordering of some of the lines of run_vmtests.sh that calculate values based on system configuration. Importantly, $hpgsize_MB is determined from $hpgsize_KB, but this later value is not read from /proc/meminfo until later, causing userfaultfd tests to incorrectly fail since $half_ufd_size_MB will always be 0. Switch these statements around into proper order to fix the invocation of the userfaultfd tests that use $half_ufd_size_MB. Suggested-by: Nico Pache Signed-off-by: Joel Savitz --- tools/testing/selftests/vm/run_vmtests.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh index fff00bb77086..ce52e4f5ff21 100755 --- a/tools/testing/selftests/vm/run_vmtests.sh +++ b/tools/testing/selftests/vm/run_vmtests.sh @@ -82,16 +82,6 @@ test_selected() { fi } -# 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) -hpgsize_MB=$((hpgsize_KB / 1024)) -half_ufd_size_MB=$((((nr_cpus * hpgsize_MB + 127) / 128) * 128)) -needmem_KB=$((half_ufd_size_MB * 2 * 1024)) - # get huge pagesize and freepages from /proc/meminfo while read -r name size unit; do if [ "$name" = "HugePages_Free:" ]; then @@ -102,6 +92,16 @@ while read -r name size unit; do 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) +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 "$hpgsize_KB" ]; then nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages) -- 2.31.1