From patchwork Thu Jun 6 13:58:35 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: 13688539 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 1DD21C25B75 for ; Thu, 6 Jun 2024 13:58:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CB9A6B009B; Thu, 6 Jun 2024 09:58:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67B946B009C; Thu, 6 Jun 2024 09:58:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 569E66B009D; Thu, 6 Jun 2024 09:58:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 385D36B009B for ; Thu, 6 Jun 2024 09:58:46 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C8DBC41719 for ; Thu, 6 Jun 2024 13:58:45 +0000 (UTC) X-FDA: 82200619410.07.8085EFA Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf23.hostedemail.com (Postfix) with ESMTP id 94D0414000E for ; Thu, 6 Jun 2024 13:58:42 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=BDWcwQmU; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf23.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=1717682323; 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=1iDkPnfnZMS40yIV9/CmRJHkK83eQzknGbWpCBWUML0=; b=SBYsvnnD/aumaLrlwHdehQDKfH5CVOgDhKrq4wMSb+eovznb+SznyItbUdw0koVuzQ4ooX no2l9N10ym453oluderP2usmxhpdle5a8v7RKRyugTVWFQuWxSGcAWke18oGi/CQNdcEix YD2x9+Eiw9H2QMyasSitFhB17ponKFU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=BDWcwQmU; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf23.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=1717682323; a=rsa-sha256; cv=none; b=MDtoKziVvOyfjTYxS/26Dhl55OployN2LkMstpktIJdbrZgVCEEIBVp68lNFxOyao2vtBa pPfupRCwnH9fIGch8l1et5CJW3LfDhA3S7vVmfGdxCUGw2OAXKQYIxIqMgM9jRqvvEVqwZ qLgcG2Ps35Z33mMKSrvLt9yE0as6SjI= Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (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 4Vw5XG22d5z9sNf; Thu, 6 Jun 2024 15:58:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1717682318; 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=1iDkPnfnZMS40yIV9/CmRJHkK83eQzknGbWpCBWUML0=; b=BDWcwQmU75+ss4BO0UXwg1SIFt9vMRwYX5YqWN8mqqeYift6qlgeRYT4m5OGzYFg7JZAMv K+jqqNpQsLZEmbBDY6tO+1DWfqKKt04KoqsbREZc+D6U7GzTx3IEmExZSaVpas2ORRenoU vxtCLOUutow5aM49q2OJkynjbO0GYw/J/39k0o8U2AZtDb+RNmieKb0GwX3QypCQHrldD4 pQVZO5abZZHkJL4hmbTWjIqRNca3XmivhdP9ux6D/Hl2nJR7xu/BavANcq3ovyvVvmi6Hd Obz33AcwjtkUbviEk1RrPnvKW6ztoxo4bLtGuWQ5TV7V7oNKM846A4LwFI8IEQ== From: "Pankaj Raghav (Samsung)" To: Shuah Khan , Andrew Morton Cc: willy@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel@pankajraghav.com, gost.dev@samsung.com, mcgrof@kernel.org, linux-kselftest@vger.kernel.org, Zi Yan , Pankaj Raghav Subject: [PATCH] selftests/mm: use volatile keyword to not optimize mmap read variable Date: Thu, 6 Jun 2024 13:58:35 +0000 Message-ID: <20240606135835.600022-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 94D0414000E X-Stat-Signature: h7mgaqec9tiz4sowfx9cw4uoxci4d6q8 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1717682322-250444 X-HE-Meta: U2FsdGVkX1+qRy6tUU7SR3MUWXC7fowdd/uJok3EYgZcAt4lyXMc6OQY4vN+822cfzqXr+i+RAww8f/BS52VS67qGHYGa69wGq+4o5i7WHBdeO9E1T0SWuP1won2IWyCHGGioB2wNFU8yd2DRqwePzoZce0VZ4HXhNi0NP+xpLVDi/m4n9hdklLQKHlJwBggv2Vu5e+bAegU9chB6kkxgSfQlf13u/kT1Y6WAh0jJgE7h6JReRrD4Eigopcm+Aa5nMIhjIKYXcRp7b5GCkSpLo6stsZSnWg7aGqS1fB9SCTk1MdrN9SIOxoF4lpZeSNLn39XmffVYJLqDATpiB18bEKdoWelwU+OdX5KAUNtvXMbPsziVvSL6w5GJB7PCfzZwN7eALvsUKnP4RsLm3W64cag92UuJbXgv6TZuRoMAda59leGFY9YQ4edNnIL8UXD0jikujTVuCI4cNxrBthscOkpN+jQ9cmTWA6hJyJEs8f9cEd25+6UuiE9Zd8xUejFdYhhyGlK5ZvJhDvGf5lo6zOi0inVb32hLvPVB7+JJCTJftoUx8si2nlK5OYnYEyHgcCbS0Fnz/dArIsxgrQ+KrCd10Ve1606EV9972Fks09/2A4kcNAREbkxGJP7O2lRJw+Pe7ARSdp11Xkp1MJSi72d08UEnPZQHJeBMKJr0f16RfgZiY1SMHlQ9S/Gy9lOzvOJNWotJWP35E/lmkZAyIuZNcfT9EVza81P59+yO268/jKz7B2/YaaoBkN8h9XqLc08lttAZoZTW3NEWbyLvhERuq1WPJHmV1kHaQUGLi06RyZ2BguojDu61ysta8E50XFak+JFAIBOlgVVnijFYC3y/OHJooWOhwmOLtYbDGuiWQDpHb9+VcvW3vzpzqw1loqGcH904YxOIw12AsrCZtRFxQJKrR8UbHgNFWw8kJnehbvXDBbB/TddoQZDe3ygQ1gsb+yRZqKlye1fSk1 kpjrmTzA 01n62HYMhrBjcZPC8/e8t694mmQZ4Wyx41YAC0zrhgGJWCqp4t1yvL12Z5iOE1eocsIQjhSKB08lzNzpLKty2c9UyVzI/ll9QcuPC5HH7SkITtyiNvtta6ruCF70QyDfoTYiqxQrYZ1/Cuq5XrOXOYSTOquD6bVTFC8I3FaqusMLh/ef++x7vvlVZkFWmruHq38ep5bhSx4Q6kXA= 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. Add volatile keyword to force compiler not to optimize out the loop where we read from the mmaped addr. Signed-off-by: Pankaj Raghav Acked-by: Zi Yan --- tools/testing/selftests/mm/split_huge_page_test.c | 2 +- 1 file changed, 1 insertion(+), 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..c573a58f80ab 100644 --- a/tools/testing/selftests/mm/split_huge_page_test.c +++ b/tools/testing/selftests/mm/split_huge_page_test.c @@ -300,7 +300,7 @@ 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; + volatile int __attribute__((unused)) dummy = 0; srand(time(NULL));