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 A1818C282EC for ; Tue, 18 Mar 2025 22:05:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB022280002; Tue, 18 Mar 2025 18:05:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E601E280001; Tue, 18 Mar 2025 18:05:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D2923280002; Tue, 18 Mar 2025 18:05:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B45FF280001 for ; Tue, 18 Mar 2025 18:05:49 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CE9791CC183 for ; Tue, 18 Mar 2025 22:05:50 +0000 (UTC) X-FDA: 83236054860.16.1F2F791 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf17.hostedemail.com (Postfix) with ESMTP id 86BC340004 for ; Tue, 18 Mar 2025 22:05:48 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf17.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1742335549; a=rsa-sha256; cv=none; b=2h/k8w7E7iIxv7Botb0CA5h3AVjGrjZKqgkw0bPvbxx0NLxqSEtpoYrnc3OGNyMxrNYaEy D9KL48RVHfs8HGwbE2+FSXLkKtJBfBtjYml0PftpCC5yU9FK1PwtWq/QbbVMn8FM8/Cwn1 ifvMQ3sga+z8Li4AQsVpDmtqDT9/yIM= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf17.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1742335549; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=frJ71jrHms6InifbndHUn3hb5aoj8DvgAwGMMc7DA4I=; b=tvykNySi/anxG6D6SuYzp3kdDYKZaKT0MV1IxKE8s+lz/Q2H7IwK3LdqM+qeLlqYkkIt5J jC+TTT0y9RTFaFwV4gYrGhYQE64iLBeRW3O9BFoPQalFttnzUFTooYnUdUfTHPB+9/86cS BJfqHooWyT09rU43LPa5qks6TbZr/G0= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DAEB113D5; Tue, 18 Mar 2025 15:05:55 -0700 (PDT) Received: from [10.57.81.111] (unknown [10.57.81.111]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 799793F673; Tue, 18 Mar 2025 15:05:46 -0700 (PDT) Message-ID: <7d4b1d60-0674-4759-8302-1e51a00756c0@arm.com> Date: Tue, 18 Mar 2025 22:05:44 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/3] selftests/mm: Fix half_ufd_size_MB calculation Content-Language: en-GB To: Peter Xu Cc: Andrew Morton , Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org References: <20250318174343.243631-1-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Queue-Id: 86BC340004 X-Stat-Signature: d5r6s8dm61dtyccrawmwbpfxxg9cdpon X-Rspamd-Server: rspam06 X-HE-Tag: 1742335548-35633 X-HE-Meta: U2FsdGVkX1/01TSyTKK75eyYU0FiOpnrcOJ1/j+3TGLM46aRzZj2O/eNavxPyBvwWyLf2e47QcznC8PvLm3A/D9X7PfU+pvFW7ajlbKYWG+rC/t1wBJ/RKfwBEWbk0hCYLSMC+lpDfQHM5HC6TPNYibXjXG0TDwnHBk8PIdx1ktWOyTZfelvJshFPrmFYfepkvInVQA4q5Nn4DU1cL7NId4vlK0sCwpgNiAAnK/bbdZBJCVQybRxZCAtdXJdAcYWd+G5mdsC5WruVU75JMd4kRPsljtPhGBgzLgdOY+d/SZF6nybgLt7PYblXyCS0N7xejWQxERC4u3/4+2sd5IGaeAU4eVN+ok9j6hwk0GhCiWXo7bQuEK55WP+hHg11VNRVCyxnC1gjv0fdjdJBBuzaTC0fjuEvl3bG90bkk3/uEbisy0pYxSBMa6Vis0uSFofExA0X3uWhL74Av72F1OI0tpjN3+G3oYYK/xOUx0a/T8+mB43f/6MTC40vv0aY/RIzIk96ek5EXPxueMDFXH7HGBKWDF5y3DQi6Obd7FpSQkJluQ5KMPLi8x2CZ40635iy+OhQS4i3oEJ5aHzjd13ENxJBHHBR+yGc3t6F9STOkhpsOSTmd4zIfIfHDBqJCFeo03Czw59WicUqKSlR45ukW7vyVOwPVWxGjH4IqhRVAU/SKgSAQT2CEvl0lOioHh5XRXVhE5wjaYXSosB1cWDWCEFWFWIZCrZeoDYsDyKEXjcR6yTAGs7spZVJ4ol2C6quHGQKdNkxTAIOPTRrU+OszOvy/k8Et2QmpdVDosh9J7G5DWrUl/BszKuR4QemmVeULVxzTMu3xRmi3/KzkBODVKoAqctpVg8pjwG+L69OhVzixbvyfaW7P3rlEAIqOLQBwlwMDHxvdkv/vA/y3QSG/ucOuIoc8MqrOMAjOAvYNqrlAS33TDMTaN3NWWnGj316SO65dTijlJzYvjhTCR SUOdAl2/ khrKfFKI65u5xyKzzAvmW3D81AAFf16pyaERd4tkh2y2XIRPUHm8PBnTp05OrjmzODQCL7FB1IuN/kEURxkpDrXpVlnM/nWWIBGFItlKev9sMywgeckPCe2aKGHn2QejVkr0uDPVJPi3xQGsl4VT67yAacif+H6W3MAJmZk6/xbaTmwUA7x0yZ4Cg7hAYkYzx3o0AadOfzOpCnK+P0fHLwZQxroLDI7xRuopMIdMMkI1IkUVPAcYsS4Hsiw== 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: On 18/03/2025 19:54, Peter Xu wrote: > On Tue, Mar 18, 2025 at 05:43:39PM +0000, Ryan Roberts wrote: >> $half_ufd_size_MB is supposed to be half of the available hugetlb memory >> expressed in MB. But previously it was calculated in pages since >> $freepgs is the number of free pages. >> >> When huge pages are 2M it doesn't make a whole lot of difference; the >> number of pages that get used is just halved. But on arm64 with 16K or >> 64K base pages, the PMD size (and default hugetlb size) is 32M and 512M >> respectively. So in this case we end up passing a number of MB that is >> smaller than a single hugetlb page and the test raises an error. >> >> Fixes: 2e47a445d7b3 ("selftests/mm: run_vmtests.sh: fix hugetlb mem size calculation") >> Signed-off-by: Ryan Roberts > > There's a similar fix already in akpm/mm-hotfixes-stable: > > 67a2f86846f2 selftests/mm: run_vmtests.sh: fix half_ufd_size_MB calculation Oops, my bad, forgot to check mm branches. This was just a drive-by fix while working in another context. Hopefully Andrew is ok to take the other 2 patches and drop this one? If not, let me know and I'll resend the two other patches on their own. Thanks, Ryan > > Thanks, > >> --- >> tools/testing/selftests/mm/run_vmtests.sh | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh >> index da7e26668103..14fa9d40d574 100755 >> --- a/tools/testing/selftests/mm/run_vmtests.sh >> +++ b/tools/testing/selftests/mm/run_vmtests.sh >> @@ -304,7 +304,7 @@ 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)) >> +half_ufd_size_MB=$(((freepgs * hpgsize_KB / 2) / 1024)) >> 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 >> -- >> 2.43.0 >> >