From patchwork Thu Jun 6 15:44:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13688699 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 0D6CCC27C55 for ; Thu, 6 Jun 2024 15:44:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82F096B00AB; Thu, 6 Jun 2024 11:44:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B8616B00AC; Thu, 6 Jun 2024 11:44:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 658726B00AD; Thu, 6 Jun 2024 11:44:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 415916B00AB for ; Thu, 6 Jun 2024 11:44:42 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BA48F1216D3 for ; Thu, 6 Jun 2024 15:44:41 +0000 (UTC) X-FDA: 82200886362.12.5EF6664 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf25.hostedemail.com (Postfix) with ESMTP id CE038A0018 for ; Thu, 6 Jun 2024 15:44:39 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=bgFJKe5R; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf25.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717688680; 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=QZa52MMCmXYplUj6krZ/HIOPht+wCpFtBELuCgPO92c=; b=FKsOUkvSsjiwYOQLsbNmYgbmaT7kdpgJPawq0LaeMYnC9TwvBvyqgIFGgLftO6vzLSTEl7 QQVUnl2fe2g/JW96WIw9UpXuwXDZqIwIvjQ5s8/SG1XIbrSSvPWr0lVm3VFvnCrr6GO2rc +/t7U778AoAjG191HLxBv6Aue6+DG3M= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=bgFJKe5R; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf25.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717688680; a=rsa-sha256; cv=none; b=Q556yrecEEjP2bctCB1wZbcaKu7Gf5t+EyhVAiITnvS2Ykjr6Ml5j4w4l7zH5uRin2Tq5L wpv3wRL8/Yw9KkVXOKISkKTz+61K5NkiiJD78h8QLwjTXbFB9ubBLBaOgTnBK49LNvEMHu ttxW9vHNeKyXtGrpBFwmPC7ff5bnlY0= Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Vw7tW20YWz9sp2; Thu, 6 Jun 2024 17:44:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1717688675; 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=QZa52MMCmXYplUj6krZ/HIOPht+wCpFtBELuCgPO92c=; b=bgFJKe5RQ9IuY8O2Z+SUI1nDjmdpsIDw2Nb50qS2PsLJ+LOwn7ApW5s1ky5g6Zgws/gLtB eI+GIZcEL1LMTGmT5dJCmABS/CiEKj/reeZTElDZ2GXagdunszv95XA8vn51cvzfmWWIUl XEi2NdOt19+9R27wXfaxkQtlAMTV8Va4tabVAfdLqfqfXEQ7b2zIS4KdD6VbFBEpmBwR00 GHj18TX3CK6gIjnYpHiW9AH2WkKl9Q/+qN6IeZ8Do/dFhnK3G7oqxAtLfUJYUU1LgngaOy agd+/reIa7GtDAv6o0aodN0bjRZQkLqJ+YyX2rcuAhpvOK9+rR6llodljOYAFg== From: "Pankaj Raghav (Samsung)" To: Shuah Khan , Andrew Morton Cc: Zi Yan , linux-mm@kvack.org, gost.dev@samsung.com, mcgrof@kernel.org, willy@infradead.org, kernel@pankajraghav.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Pankaj Raghav Subject: [PATCH v2] selftests/mm: use global variable to not optimize mmap read variable Date: Thu, 6 Jun 2024 15:44:28 +0000 Message-ID: <20240606154428.672643-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CE038A0018 X-Stat-Signature: xrs8mq5c8f5u9timt5xbm3ojrddf38we X-HE-Tag: 1717688679-622178 X-HE-Meta: U2FsdGVkX18trMpTKxGv6s94NyY8UQqngNWA/o3x3vVq6vf9EDwZQ6Q4bmnySq1+ZXnczge5jh0S1KO8OJkY7a4qSUnHB6XaB6zaYeV0urpyQ5S+66yqwNgBgvokBcru5V5GPc38GHmoB5fyJ7NuP04e99423q7q+aRpo9Y7OR10Y9hYD8vaGYYRW/jiRDSSi3tJboBflHPhasgettjeUrvYlfxW6mGx6huXNAOG4/45KO+X9ZlyRRfBFPGJJHp+HhrXlRp3KoAlWJ9VrpTT7Je9iEH0FLE449/F8iJr8W/k2prTl2zdmjOdjKxC/Bw4sZ+pKHhldqKF14rBD1l6ZZvgm1S95+NlnBvYM25M+JhLEPo3lV6p1ndeFbdJnFWY1z7YkSVd3CDf9lIBoEh7MlQx0zAeHOONgL/fDvvtO5i1axCcGIzEKIXbH52od6nlPBgB/NfYV0UFfSiihrrYqESd1clDleFRmcG80zzAos2TbMO3QjFVESY05b7jGL8JuiIPQtpkT/sJiTEVmyLiBgzYQ9vvuL2UD5vApkK+n5qZJUrZPXbVrfo/kvQR5NYC7h2uMeem3OTwbWaGhOOfw0xyCjOwLotgOH+dybj8R9SIhzwmBcd2mHq2SIvUuwDF7ObCCAmPBAmOIsglLM3giOn7yufyh4ssYEfv6QDzDD2lVYEKJmax8Q4ptNfggPEZ60AJVpc5O1uq1Ww40LM7m5MEQURFqM+LK4pt/2KDP9WD2hTnNigx6zFz+NDc929917uITbTixKT6aiNieJAxGW+G5yo+KA5l8BSxEoSJW6Waun12J9Zqruwo8kdJG0NZ6lkFJ36rHx7oq3GFwHl8HLZK7/hLO/bPXFCOHirwS6lrZpkJUMZ6AW3mpEi37A4NgtHFBjRtogKdeYlMo33c37hgtYUaFM1TMz2qqPDs4pmM8KZgTVSQlUpL9jV+OiGu+1OMMzhSJD5hx6WBEhX pAOqEFoJ 8pqBG8JeC2dK6evrBdulvj/dBZwEcit76KDJ9XMxaKSJkIWBx6JDgJmAir6SBaj1ZFs7YxNqfu48NKVeMLxTr2aDi7Q1ufTKU8IDjYAoPQx4MFTyatxYQHzqK9olxzK5rYngUKDZ6Mm2u8ADQi06+bqndBfh0GBQXRSWUcP4OIT0lfs4D0xiW/38zX+1AKYIg3blE6hx2ylXyKQN4kKBPJH5EdODAxbs+ex3n 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: Pankaj Raghav create_pagecache_thp_and_fd() in split_huge_page_test.c used the variable dummy to perform mmap read. However, this test was skipped even on XFS which has large folio support. The issue was compiler (gcc 13.2.0) was optimizing out the dummy variable, therefore, not creating huge page in the page cache. Make it as a global variable to force the compiler not to optimize out the loop where we read from the mmaped addr. Signed-off-by: Pankaj Raghav Reviewed-by: Zi Yan --- Changes since v1: - Make the dummy variable as a global variable(willy). tools/testing/selftests/mm/split_huge_page_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) base-commit: d97496ca23a2d4ee80b7302849404859d9058bcd diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c index d3c7f5fb3e7b..c4857de2c042 100644 --- a/tools/testing/selftests/mm/split_huge_page_test.c +++ b/tools/testing/selftests/mm/split_huge_page_test.c @@ -23,6 +23,11 @@ uint64_t pagesize; unsigned int pageshift; uint64_t pmd_pagesize; +/* + * Used by create_pagecache_thp_and_fd() to do mmap read. + * Made it as global to avoid compiler optimizing out the variable. + */ +int dummy; #define SPLIT_DEBUGFS "/sys/kernel/debug/split_huge_pages" #define SMAP_PATH "/proc/self/smaps" @@ -300,7 +305,6 @@ int create_pagecache_thp_and_fd(const char *testfile, size_t fd_size, int *fd, char **addr) { size_t i; - int __attribute__((unused)) dummy = 0; srand(time(NULL));