From patchwork Mon Jul 17 10:31:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13315415 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 D2857C00528 for ; Mon, 17 Jul 2023 10:32:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A64EF6B007B; Mon, 17 Jul 2023 06:32:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A15BA6B007D; Mon, 17 Jul 2023 06:32:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B58D8D0001; Mon, 17 Jul 2023 06:32:16 -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 7EC306B007B for ; Mon, 17 Jul 2023 06:32:16 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 42E3C160422 for ; Mon, 17 Jul 2023 10:32:16 +0000 (UTC) X-FDA: 81020739072.16.3EA0171 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf19.hostedemail.com (Postfix) with ESMTP id 7FC341A0003 for ; Mon, 17 Jul 2023 10:32:14 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf19.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=1689589934; 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:in-reply-to:references:references; bh=/uEzG53FLjd2glqlFJWx0HAfJNrq3vkp38/U3IednXU=; b=CEsGjUgrGS3HiMJ00MO0/OYo+UUE4SbT+NhVTZ51Oge5mBHf7lTpd8a7DK0KEh3hy4OEb6 ZiSTOxdRO7I07yVbcGrv5iXVQr/ydVziKtfj+kjAK5YvC6z2fQkRyytC7oD9onhV80iFHn j9ULBsdcZ6SnI37li1Jcd4eYHaoEOXQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf19.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=1689589934; a=rsa-sha256; cv=none; b=GqnPbOzVgF3lfpo/syEAsNq+0XOAqAADLne5rPnPHjqVPI68tq94ZPVw6sAok6sQs5oTx/ fbZVIN3X2GpEyrqzwr/TLOVoV1mHwWwvBeDUsmaCQGiwLGGEttvRq+/Kbno3vduXJ7fy47 phzRfFVOVwFF7UIUb5zMuo52DBh57Xc= 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 7416A2F4; Mon, 17 Jul 2023 03:32:57 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7B42D3F67D; Mon, 17 Jul 2023 03:32:12 -0700 (PDT) From: Ryan Roberts To: "Andrew Morton" , "Shuah Khan" , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , "David Hildenbrand" , "Mark Brown" , "John Hubbard" , "Florent Revest" , Peter Xu Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 4/8] selftests/mm: Fix thuge-gen test bugs Date: Mon, 17 Jul 2023 11:31:48 +0100 Message-Id: <20230717103152.202078-5-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717103152.202078-1-ryan.roberts@arm.com> References: <20230717103152.202078-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7FC341A0003 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: acwr99w4hbo944w4z5dy5r6tzx5yahgi X-HE-Tag: 1689589934-464039 X-HE-Meta: U2FsdGVkX1/bdBzp95DR+zkA2l167MwdN/bcBobmyYRqT3pzpb/nUkdXCJJML5/CGt+CrmHKHGyr0lCKtDbH1VZrrqjAneRjxqXOE4l/WGYNqel0aSVHjNB6H4KSYIYkuBR6p4bQA+Bc/jFEdcg5RWRDOVvLl38TJyfgxgNG9hM+Ka3aMxRLJPdAdWuRDtnzlDLrm+dbwFUqPdKv7H4a0o6RdeAWmfisbil8Vd1vp6PFExKEmqZwgyV2XFKhVj5C0pk/32N0l4tKlKlRwb9e7RmeX/bGNvgvWi+liAhccdb+SkEVMD7haLYeQ+GYCbzY6dJO8EnZNxqzDONbJwBcaRIW6sC1c0KiKdSxKFYC0fJfNRAV9cJhk9GbYs0HGNYjnFf3RZHBg3CGriZ0HtSPQo38HkW+56afrOFFyyEATWInx9S6oE52pUxWWuLrydi9uuio+yRF2hkCGxYxPnHJVj7rHnujoD0Y63pC3hH0qYUvRK7e7Fjs8UZFT77R4HEJ7friYQgOtHpQngQXUB4JijU5Owe8Pd+hSrBxC1yySsPNuYOycuUHXB8QjN0MtqIGV/E/xFqkx2I3KAtcKgrpHimEI4A9X0CQKiNmgOEriQT/2//+Lj5HeWzuvRLcwFOrxczMJDxqyXU3ie8oJKfSFvfXPQmWw5iLXVWiZF72f8xG8U21LLd2dAUbalo5bXYepWqbKImCUDhRqurMxjn/cz2DokRuhSvzAE8VrJSudr4QFRA07PT926Fn+H5dkt4d2E1HwkwyW+4j6DrhNxCWukMt3wkZFuJiRhATLxL3GI9FpmHSCjWsa/Q16sn4H9ugu2U/glgFGLxOd2PaS2aiXcmc8agFJvyzzOphBH9akdxqFl1ttzEJ9/2XwLQjtzY88jVf5Oe2XqgkhKLzDem4npG8eP+mdEUd+Am+JKQdjPA9k808fGRSh5o7Kij/E6LBqbAfFX3rXnVq1IS/55s sTJtWMPw aeNV/Ve+Cu4HnEDaJ801Z9lc/QXbN64fw+pITuLTHU/tyRKulgpYlHoPh4rvHCQpr6VT2v4/xifkjY0Bhhmwpb/PmBgWBk8Fm9IWRSpzEwZXkxAkcGF+o7wTKZZDFr5Piyoq3G7mpB3snCvvM7k/FbV8SsghMqzsrqoUE 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: thuge-gen was previously only munmapping part of the mmapped buffer, which caused us to run out of 1G huge pages for a later part of the test. Fix this by munmapping the whole buffer. Based on the code, it looks like a typo rather than an intention to keep some of the buffer mapped. thuge-gen was also calling mmap with SHM_HUGETLB flag (bit 11 set), which is actually MAP_DENYWRITE in mmap context. The man page says this flag is ignored in modern kernels. I'm pretty sure from the context that the author intended to pass the MAP_HUGETLB flag so I've fixed that up too. Signed-off-by: Ryan Roberts Reviewed-by: David Hildenbrand --- tools/testing/selftests/mm/thuge-gen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c index 380ab5f0a534..16ed4dfa7359 100644 --- a/tools/testing/selftests/mm/thuge-gen.c +++ b/tools/testing/selftests/mm/thuge-gen.c @@ -139,7 +139,7 @@ void test_mmap(unsigned long size, unsigned flags) before, after, before - after, size); assert(size == getpagesize() || (before - after) == NUM_PAGES); show(size); - err = munmap(map, size); + err = munmap(map, size * NUM_PAGES); assert(!err); } @@ -222,7 +222,7 @@ int main(void) test_mmap(ps, MAP_HUGETLB | arg); } printf("Testing default huge mmap\n"); - test_mmap(default_hps, SHM_HUGETLB); + test_mmap(default_hps, MAP_HUGETLB); puts("Testing non-huge shmget"); test_shmget(getpagesize(), 0);