From patchwork Mon Jul 24 08:25:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13323546 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 EEE9DC04FDF for ; Mon, 24 Jul 2023 08:25:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2EB5E6B007B; Mon, 24 Jul 2023 04:25:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29BB26B007D; Mon, 24 Jul 2023 04:25:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13DA66B007E; Mon, 24 Jul 2023 04:25:43 -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 EE74E6B007B for ; Mon, 24 Jul 2023 04:25:42 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B2A8BB1F89 for ; Mon, 24 Jul 2023 08:25:42 +0000 (UTC) X-FDA: 81045821724.23.1B0A1ED Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf05.hostedemail.com (Postfix) with ESMTP id F20AE100005 for ; Mon, 24 Jul 2023 08:25:40 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf05.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=1690187141; 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=RlF+OWSt7Xg4Y8gUX/1pDNyyb2oDlnFwm/E3+/VsYzs=; b=tIfKnQt/lqdgONNKtBPXEEL6MPKYrqulZKoBO/Vqz8ktx2p3FN0oyfOlncoUeZrHdYwEQz 4JuiQXbH4xTtNvaJm8DBi3DJ3oVEL6+suMh4AVSKrNXqtdctWV+mLajQMq6upzUU5iZv5r bWjw8sj4twQzU9Y3jOd9TDy7Ha4ZG7k= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf05.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=1690187141; a=rsa-sha256; cv=none; b=48VLf1btxDCCGIgYdrYZzeOpwQy7HU4HDOq5x+WXLE/sAkYpE+Lk8Wh85S1LNDgIML3zSB UeQv7+ZLyYSkh8CPFzksMQVN6dWxgMF0ii6hZH8xO5kFcxFOmoNqLhrcoO3sQIvL6H6J1J GKmplQDXsA/KsjAeTwTq2QiagxTtPxI= 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 BDAAB11FB; Mon, 24 Jul 2023 01:26:23 -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 DA6DE3F67D; Mon, 24 Jul 2023 01:25:38 -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 v3 4/8] selftests/mm: Fix thuge-gen test bugs Date: Mon, 24 Jul 2023 09:25:18 +0100 Message-Id: <20230724082522.1202616-5-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230724082522.1202616-1-ryan.roberts@arm.com> References: <20230724082522.1202616-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: F20AE100005 X-Stat-Signature: f8f9d9ck4jy3hkqq9wsg9tpnkro9u53a X-Rspam-User: X-HE-Tag: 1690187140-687266 X-HE-Meta: U2FsdGVkX188bKHF0jo2iPulRL26RAVLcj1eE9fvdr4HklTeeuvY3nq2wb19TonoYZZjWOqG90gFC7GOupo+QeoThH0Am8i1Ey3M7nW5MyOnuJYrhRaVGDJLdEDbjYGBxNkqZcguR+9EDREVCoRQJhQBra+K0Dtyxzr1411zwbbaIjFi0KzcUEPX+iVuGOJjGDJs4t3NDfbfKShkdFl2WgN0hMa7M8duV4mr7LbLPQZc5fTOHN46Q8x5qhp5xX+2g+QB22Itwa1zPrsF8A46kIVLsBlulpFpf1ZLdNJQ3JJHcUBNNpSpXhTH4t5NxknVV0QU1X5ryqBUuHwgD6kiwuOw2gJkcudRgzNhdPaALivWDqkNlRTX1BlgF44iutGk/xdL98Q0niglq7SOC5v64khNGv9+imBYUDr0eJl+5vYJ38iRAm3YnDAUE+++JG8xWvChHQ0qJk1r7h5KlGbrLQd5UB//FxtzGjiHY7EVOXx0tOqlvglkJyGwpJVuPS9m2t0/g1rE1CFDsq0uQ/9wVhQnIfG0Uikzlvb1IFdAnQpZBd2wbopsq1rEXsFOENDKhdfGUDJ2hJt1IzXN2tONmRmHqDo/T5l7ui7lgWqJodYcvkOPT+Goowf3it/XQdn3Fuf1L2ueOWGrWX8vQbZ6+MOR6+ad5JJZ2N1YJiVRpeGJ8j+2T00UsGfRi64AWCWRMDagQTuKP5Rca391xPXjHm7M7YMIz+tyz+RTVmqV2+magShRr+G0MLcdGmYXUrTaEnRFNXXSo/7fj9xs6pR3gX4+fz/6SZqhXiJBEmcJLZbfaqwrpRds4cssuSpJbWMiXBdrXcCeifkjRwkTt4Cj3lx7Xy+CDBE4AmVmfcsrggrFtDC9rW3C/Y/5HYO4hYdRG7YlsVmOCKxSMl5QJmr71jcVJnqP9J+TqSgDD5xOiEiEOIdkxOzJLtllqRLToP+EJqXcxW0cl9Vto6hh7ft eRnz34KD JC9G9L/vUWML3EpGRrmYvMKpUoaITXkOO/TuvPwhH00G+rBJzBNQyp4M6PK8JIQtDo/NhfvMf98cNESHR4WDrrF79UQNvyEUsVTKQONVFQcKHDdDUfJOyK3xh/HbfkfsagNie+9ehfbLo9+dFPWqGbY/DHj70FFlgM23LmZ2JRAKH4t95cTpBO/RJnA== 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. Reviewed-by: David Hildenbrand Signed-off-by: Ryan Roberts --- 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);