Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp494796lqt; Thu, 6 Jun 2024 09:22:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUt2Ofdsj1n6F36lZJzqgxqWadPmzruH+fqRfVPzFO9BWjDf8roxVVSjBUWUHQyC6aKK6Yn3/19siRwI/zyUHBltdNdGNy4HYXylOgngQ== X-Google-Smtp-Source: AGHT+IEajvps0/xBHmtdra4r5pwwbeTqckA5OZIOetbpAtQDVpTnKGWF6xZ2MQZtkxJGoWPC+SKM X-Received: by 2002:a17:90b:1b43:b0:2ae:b8df:89e7 with SMTP id 98e67ed59e1d1-2c27db4acc7mr6373527a91.38.1717690968130; Thu, 06 Jun 2024 09:22:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717690968; cv=pass; d=google.com; s=arc-20160816; b=EnQp7MQyOHhcksNMtEVJWC/EViN9XY88zuqu9WD22CQ59NxzZF7ojKPAPp6XpQKV4m QvEQ9yzH14iB6m4r8quRQnV7eO8hCFI8JlGxcWmUaPg6a7TZW98evR8OdteEU1Q0QEvs w70xggG+83XP5YXrHi1vZnd8mCd4R4qa59JxLH0VDpqPGeyFSAXmDtyOTaF7+/dHMJ2Q taKNiA3X0+DodJpbiNuBCFsp9PI732P/USOwKhg043Ci2mOzr5tCA65M0GIRfVna90dT Y5Mqyr27TVwyDelmyUiZF33vsRfSyiKmLuBnfNA5NjAurohnfKZIoN5JQNVxWyO671Ze Dn0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=QZa52MMCmXYplUj6krZ/HIOPht+wCpFtBELuCgPO92c=; fh=fIvobVVMO6NnhXAYkz5/iNER7hNCJqh+z5Kqu0ju50c=; b=w7xPeXuoTXvk9pCJ6zpaaiCmNxrY9+vD6DrDIFBVMYMMcJKP1wE7fI2VjXzMo8+q5+ B2k/do+lVt/Avj5GeNr6HcvA3vJINnl98CJXuhvisbk72eYihi0mhVzDHkE4xwovyxWd FdDrVyOoi4/bfXb3NfiEPcPwe/5trPUw1yYdJvzZAVkyaEIWz1ViU4iRLgTQIQVRKanB 9DWFtAV+3FSaLYc16lEEsDs/4LZu/by3C3oD5+RSqT0+vMKwqHFBTG2SmhISWCkA/Dqp QDiEdMv00v/SKdk/83a2yqUUyPJw90D5yjjh+mdtkHnKNrCyEigf6SzK5c6mjmSK9r+8 NZxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=bgFJKe5R; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-204595-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204595-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c29c4b0897si1330049a91.186.2024.06.06.09.22.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:22:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204595-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=bgFJKe5R; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-204595-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204595-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1C9CBB27C47 for ; Thu, 6 Jun 2024 15:44:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3B7C19753E; Thu, 6 Jun 2024 15:44:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="bgFJKe5R" Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B6A319751B; Thu, 6 Jun 2024 15:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717688681; cv=none; b=juBrSkbv3K3Tncip8ZesNQC2TkGaZmZshhUYXnTPt/BQWYIRyCvhuDK/DcmTKN9eSNcoWMmA47a4Uz/8yzSCzgch5uZ9+HX8O6T/D80qH6PRjWbBSqD3OjWCQXgtZlvwDYDUjpBS0T+HTs5eNaGiyReoy0xkwPyYh82PqRd3Tv4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717688681; c=relaxed/simple; bh=p3+HcpSv7KTH1ay6GWfjRUjkVsJ8ZSafrdi9MyeRX6I=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WdZi8u9HHx6+xVLlfO/ckwiRoV+1NEy8JAX5XYL2B6IhkUP0DEmmo5wVET6MrxVKqH34nNxkJEIaoJy2kRzBVRXkkJsDmyYHd90DtR4vKm3LF7ILtqS2W7AOcZrmd2M4/9AYvu9ClPIHa7Y6qr4BtGo61UmQ0QByPiYFObglnAw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com; spf=pass smtp.mailfrom=pankajraghav.com; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b=bgFJKe5R; arc=none smtp.client-ip=80.241.56.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Vw7tW20YWz9sp2 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 --- 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(-) 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)); base-commit: d97496ca23a2d4ee80b7302849404859d9058bcd -- 2.44.1