From patchwork Tue Feb 18 19:22:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Aquini X-Patchwork-Id: 13980651 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 4A0BEC021AD for ; Tue, 18 Feb 2025 19:23:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80654280194; Tue, 18 Feb 2025 14:23:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B6C4280193; Tue, 18 Feb 2025 14:23:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 656F8280194; Tue, 18 Feb 2025 14:23:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 451EA280193 for ; Tue, 18 Feb 2025 14:23:15 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C4FAB4AA2E for ; Tue, 18 Feb 2025 19:23:14 +0000 (UTC) X-FDA: 83134038708.03.891091E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 01E76180015 for ; Tue, 18 Feb 2025 19:23:10 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CgXHt5HO; spf=pass (imf24.hostedemail.com: domain of aquini@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=aquini@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739906591; a=rsa-sha256; cv=none; b=cGw8Hde6/3VT3yaTMzH8k/k9AQ5C+sUGNJMY4HQHzC/soMkuCJ9RPExf5t3pZL1WZdyTfl EGsKAzQcwtFhOzBqNcsn6hvaE9uDH35ZCeoOrp1NJKq98wvAtcjQndgEuQZrP6eBnDRLIS be5W1zag8n3mgs6Z/omDtVdY444HszI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CgXHt5HO; spf=pass (imf24.hostedemail.com: domain of aquini@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=aquini@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739906591; 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=MERCQpBpo0tKF1DN4IvIC5vT6oTv8oj1DKhfqvfja4w=; b=0qIMQhKdXu5eQJjv/nbkNGdJbvrO48wxdjIHL6PVb8fCy3Fw3YDrdy+/vqM0f6P4xNqtSg FBUD07sm0f0c6FtDdlnLPcM7tTyMo9QW7+fhhqO3yo/MGlGuOyS2JjWyrmCiwpqAcyXCMA GbGGqKS7MSxHNx7yRaaQFDRKjJfYqFo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739906590; 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=MERCQpBpo0tKF1DN4IvIC5vT6oTv8oj1DKhfqvfja4w=; b=CgXHt5HOOrx2uVxroYDQxTo6uKX8WfxFoV/uwGURoSfR7+MQ3ioYxGMRehshJYv1xzQ80Z 6/zZhCPf1OZUhF/pbDNO9b12Yq5+zoLZoddWo+rb2QOiUZNGZVw/yV/Se7J0wSKWNHSD5O 8xcY3QllgeTodeBwmA2qGBKR8S3gDSM= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-sytx-8WxP9i_Ga2YRr4Ajw-1; Tue, 18 Feb 2025 14:23:06 -0500 X-MC-Unique: sytx-8WxP9i_Ga2YRr4Ajw-1 X-Mimecast-MFC-AGG-ID: sytx-8WxP9i_Ga2YRr4Ajw_1739906585 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6AC891800878; Tue, 18 Feb 2025 19:23:05 +0000 (UTC) Received: from localhost.localdomain (unknown [10.22.58.10]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D89C81800374; Tue, 18 Feb 2025 19:23:03 +0000 (UTC) From: Rafael Aquini To: linux-kselftest@vger.kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Peter Xu , David Hildenbrand , Shuah Khan Subject: [PATCH] selftests/mm: run_vmtests.sh: fix half_ufd_size_MB calculation Date: Tue, 18 Feb 2025 14:22:51 -0500 Message-ID: <20250218192251.53243-1-aquini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Rspamd-Queue-Id: 01E76180015 X-Stat-Signature: cmpe8pap4erneocssqj3spy3gigpiazm X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1739906590-973816 X-HE-Meta: U2FsdGVkX19E4RCYlI/EZU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3BoiTaoKUM4bB3itDMTTpbt6zwI0vnD5Vj96sj3bkqmYTTM3RDGQJUfoGdggbxU0Rg6lomwAyRMLcpZ8+VfWtM0/rB967KJdjpcT8jhN/fabgzBul9HoqQ7X8NNJhF9gTTbiqiaWvCbs57CCUrhXSOPMiB9/8pbENMv7S6LOhC00kvKLRapOosin+RpEpY2861+mZJ94qkva7vnbjTnjoqEaVj+bwGSvvU/AdPC07r7ZhxpUuRJIw0SscgWvoHXVOUaTyrt2ZIlg== 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: List-Subscribe: List-Unsubscribe: From: Rafael Aquini We noticed that uffd-stress test was always failing to run when invoked for the hugetlb profiles on x86_64 systems with a processor count of 64 or bigger: ... # ------------------------------------ # running ./uffd-stress hugetlb 128 32 # ------------------------------------ # ERROR: invalid MiB (errno=9, @uffd-stress.c:459) ... # [FAIL] not ok 3 uffd-stress hugetlb 128 32 # exit=1 ... The problem boils down to how run_vmtests.sh (mis)calculates the size of the region it feeds to uffd-stress. The latter expects to see an amount of MiB while the former is just giving out the number of free hugepages halved down. This measurement discrepancy ends up violating uffd-stress' assertion on number of hugetlb pages allocated per CPU, causing it to bail out with the error above. This commit fixes that issue by adjusting run_vmtests.sh's half_ufd_size_MB calculation so it properly renders the region size in MiB, as expected, while maintaining all of its original constraints in place. Fixes: 2e47a445d7b3 ("selftests/mm: run_vmtests.sh: fix hugetlb mem size calculation") Signed-off-by: Rafael Aquini Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu --- tools/testing/selftests/mm/run_vmtests.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 333c468c2699..157d07e5aaa3 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -304,7 +304,9 @@ uffd_stress_bin=./uffd-stress CATEGORY="userfaultfd" run_test ${uffd_stress_bin} anon 20 16 # Hugetlb tests require source and destination huge pages. Pass in half # the size of the free pages we have, which is used for *each*. -half_ufd_size_MB=$((freepgs / 2)) +# uffd-stress expects a region expressed in MiB, so we adjust +# half_ufd_size_MB accordingly. +half_ufd_size_MB=$(((freepgs * hpgsize_KB) / 1024 / 2)) CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb "$half_ufd_size_MB" 32 CATEGORY="userfaultfd" run_test ${uffd_stress_bin} hugetlb-private "$half_ufd_size_MB" 32 CATEGORY="userfaultfd" run_test ${uffd_stress_bin} shmem 20 16