Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5401771rwp; Mon, 17 Jul 2023 03:37:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlGKfE92ZnVgcnhGv6tBGF6YiuHmaxM48eB/24nfiMhWsJwkC3TdTH8nfrMYRdRZ4NFkRTT+ X-Received: by 2002:a2e:83c9:0:b0:2b6:a057:8098 with SMTP id s9-20020a2e83c9000000b002b6a0578098mr7704490ljh.0.1689590253780; Mon, 17 Jul 2023 03:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689590253; cv=none; d=google.com; s=arc-20160816; b=BN8iHruVCEIB7Na4HehEoJkOEXj59mFd5bo4n4+n4UIj4tTCT8rLYEYCzikhSdGzKX sqpxlW4GMt7RmvnU5NZ9JKS05FN3ewvgJBWFL2xhqfPzhuBG8Oma6Jqa0oMu2If0TB1A XB5Yf6j9svWFNVhg7eUHzy92C2oAbfIX8ScMpB5PAEcpUrZWdBI8k8q6r3E3nLy83C7h ieWE2tAZ4RAR2Wi49o35k9dbXX/aJ1wTEly9kCP4JJpZaOMItIQNuB+TgZ0H4n1rIxUR WdPwqXx2x1o/bTQHlAyAnSiQvzpg8nS4Pxw3/NwJi2iTr9pg/7IfXkXLdtguxfxDCziM bHHw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/uEzG53FLjd2glqlFJWx0HAfJNrq3vkp38/U3IednXU=; fh=OUPfCZjK3Gm4uAxJmzTYkNGoALdOI9ZG4q/pkSTXiCE=; b=qW6qCqVo0gfjSXBf6E2he21tfchY1IRnd+ZLrMyJxCcL787YWgy6Fpj31DeeggVTGD UMFnbcXsWCGTq1ruQn5besPisB6efvLfaHD6ALBVlwaPdg3NTd4Abh8yHMd7mXjswBVE fSjHjj9q0TMdGF57j7yT5G99S7ok4GU3ipEcmy+nxwO5P2XBTaboUT6d9yYWO8/jIYH5 Xbq9FFqKSkcbaL0iwCotgsvuhP2HBNCoNU4sXAzehKc9LzazxI81tjsm5ogivymOsfUK ii3iSP0P64ibCxBN2zB2tPA1yywAvR3wQrfROicKkpsdDNdwhowZGQcTX4llwGxqA5sA O+Ew== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a17090616ca00b0098be1e9150fsi12574179ejd.298.2023.07.17.03.37.09; Mon, 17 Jul 2023 03:37:33 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230357AbjGQKcU (ORCPT + 99 others); Mon, 17 Jul 2023 06:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230213AbjGQKcP (ORCPT ); Mon, 17 Jul 2023 06:32:15 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65D26A6; Mon, 17 Jul 2023 03:32:14 -0700 (PDT) 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?q?J=C3=A9r=C3=B4me=20Glisse?= , "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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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 --- 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); -- 2.25.1