Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2405712rwi; Fri, 28 Oct 2022 06:47:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4n3gPPMOlmEAS0omilKinw12LDUeZkQKBQBA1BFTAE5ZXvLVHNbKJh6dM0oMKWHFX3iIw3 X-Received: by 2002:a05:6402:42cf:b0:457:ae6f:e443 with SMTP id i15-20020a05640242cf00b00457ae6fe443mr51640678edc.299.1666964857314; Fri, 28 Oct 2022 06:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666964857; cv=none; d=google.com; s=arc-20160816; b=MC/flfAKIum9EXY+RqyaVOlJtEpf8rkq1unNyVuEU8bDG95kLYw5hznwrppT15Mzlq iZ3oD+GTsS+jZZBiOXvzpR/wXU3P4ZIfHG4sTfX+Iz3nLmajIc5dCo1TCkz0PFj6CsKs g7XijX+0Vj2W/AfQHLPSio8+gPfkglIfwBWYaTRaQQr7+p9uy2w7Gnd/zFT43RxkiS98 n9i9Es3P3/vxWSXBup4LA5q3O075xElRTmWZLpTIVANsH/vElEH695XCHj0c0By4HOq3 3YezC0b0/Ua061x73HmhfCfUw40fDk97b7eIMNwURLOQ0Rp9Xb15m7n8+mzERb2VnEN+ 31cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nMEqJ+SJX81wA4F4D8VcQ1oWVGj7/HJA80MojM8MPSQ=; b=YDSAG3HRo0p61z/J7R9HDIi1TTo3NvtIL4ARZLY/+l3z1IGMZGCOntghHWKaF8auz4 2qZ6azqxwx1YtuHbycdx5xRi1F3KdFCmO2NYgQFdaCoEVC22cRv1m5QEEUxknIWUo7GA J220fBGx+7HPgAwrB8ux2A8Aouno1V8wimZOVIIaxw8f/ucObychQvciIQfN46+zlMIu oF/8czUbH3pNhlfJlB7C084riRVOh5E+bOHJIFu8S7/JEyGFdnxlwOULqUsoZWQWjSpC YPOHT+Dmx5KKh8offzNnS24z2ME7IS3HkeYLlfVUYqcPShfnubdVfUtJgEbugq/1/uVR zvKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Txwkx/3Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du12-20020a17090772cc00b0078da30cb4bfsi1957505ejc.428.2022.10.28.06.47.12; Fri, 28 Oct 2022 06:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Txwkx/3Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229450AbiJ1N2K (ORCPT + 99 others); Fri, 28 Oct 2022 09:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbiJ1N17 (ORCPT ); Fri, 28 Oct 2022 09:27:59 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E5BA1CB52E for ; Fri, 28 Oct 2022 06:27:00 -0700 (PDT) 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 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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