From patchwork Wed Oct 2 22:58:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchana P Sridhar X-Patchwork-Id: 13820516 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 6536DCF8548 for ; Wed, 2 Oct 2024 22:58:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EFA336B04F9; Wed, 2 Oct 2024 18:58:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA9C06B04FA; Wed, 2 Oct 2024 18:58:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D71E46B04FB; Wed, 2 Oct 2024 18:58:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B08926B04F9 for ; Wed, 2 Oct 2024 18:58:28 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 206CC1608B5 for ; Wed, 2 Oct 2024 22:58:28 +0000 (UTC) X-FDA: 82630177896.27.5B56D5B Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by imf26.hostedemail.com (Postfix) with ESMTP id 19288140016 for ; Wed, 2 Oct 2024 22:58:24 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Rqp5CzBn; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf26.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.9 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727909866; a=rsa-sha256; cv=none; b=BKYGgJotb90bj+Nr3ZVAzKJyD9Rb73zE9QUiZ5DmcvxAPyiwCVa0MMJxVrca81ovmCIzDt +CnpPLFc8iDLbj6YODh4QvM9iMqIYCu51nW/3eU1d1BjXUvZhlurowUPRkQw0SXshhV1KF Yyqiv/jO8PczgMj0P1k5iK1xUxE4crY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Rqp5CzBn; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf26.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.9 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727909866; 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=sZiCjy+GsUtxDgXUnT75QzEzfYVkiq+wm750SP+AZcA=; b=Fy4L+YfjWN8Uc0bOnEBRNiTGoENf/djW2PW61c/6r9Q9SlE72KY7SqU6XuxxaEbA5YRO7C WORCd9m7Vgvc7KJRQauYAd7tdJicLW3h/k+XzzHAeCJV6H+O1EgPMFR6enfESlTiFvdZ0/ V9CT8HNkJBQ1P8kobYVQPIEfb3T6QYg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727909905; x=1759445905; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SQEhVMAwSnwMZnCw6ffBTDahTYRYzjlj1IySflcrx8Y=; b=Rqp5CzBnAb5aCAZO2s/BZh8reLEhcJlZ/RFe1CBH8403F5V/DBxAVBDQ HhzttLqt1jOZXUvaSbIR+/zcBljL+W0cV3NJJA7/wuA2yN0d70l2W+Fxw pMPLdmIHgZXafK3DtU8XJXksZcqgq498yKJllTFubXNBOIxb9GWOKw6JI f+MhDHgNAsfAizShAWYDZtWWXY3oE0tr7Ux38vEQa8cvlN2DP/BJsfgpc E3DgY4Tf1nCLr9TqwgjKQ1MZy8xhsYpPyCrWJnU+kXNaMaoSSaGvAzmfW avCVpUecY4PNe+JYxJWMWATd5oPgl9moQtrfHBAG+igwNesWKVps7OXWd g==; X-CSE-ConnectionGUID: VR5kxhUoQGS4hBb8TlrkvA== X-CSE-MsgGUID: 21HVvRWrT22fKM1KaNclDw== X-IronPort-AV: E=McAfee;i="6700,10204,11213"; a="37760095" X-IronPort-AV: E=Sophos;i="6.11,173,1725346800"; d="scan'208";a="37760095" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2024 15:58:23 -0700 X-CSE-ConnectionGUID: 9nswhxPHR5O16PHhiid8Eg== X-CSE-MsgGUID: 2s9FTVVUSqyq3SS2FzLT+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,173,1725346800"; d="scan'208";a="78170025" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by fmviesa003.fm.intel.com with ESMTP; 02 Oct 2024 15:58:23 -0700 From: Kanchana P Sridhar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, chengming.zhou@linux.dev, ryan.roberts@arm.com, ying.huang@intel.com, 21cnbao@gmail.com, akpm@linux-foundation.org Cc: wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: [PATCH v3] mm: swap: Make some count_mthp_stat() call-sites be THP-agnostic. Date: Wed, 2 Oct 2024 15:58:22 -0700 Message-Id: <20241002225822.9006-1-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 19288140016 X-Rspamd-Server: rspam01 X-St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JLzmOqxDiuyXwwOKI20Z++PAQaqVUwZ2+klaSgWJLlE/56K+TXhnnjDSN70B9peNyB3Zzs7vAC/ef17Lwto/EMTvtR3pFBaBmGleYFscYndgNttHCU0+U9c0/z6cy1i3S4j3T/kyfkL026GVgWEYxT3m9Dg0MdPZX9LgyqcB3L/qs6erqklJAMz7HpMhNUt168ZrIapFXsmAqv+p9jEM5owqOyr8f8zW76rMIbkq8eYmO+zWzo8tGrSaM91yG8N1ZziDCXLZD9pA/8cg== 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: In commit 246d3aa3e531 ("mm: cleanup count_mthp_stat() definition"), Ryan Roberts has pointed out the merits of mm code that does not require THP, to be compile-able without requiring THP ifdefs. As a step in that direction, he has moved count_mthp_stat() to be always defined, resolving to a no-op if THP is not defined. Barry Song had referred me to Ryan's commit when I was working on the "mm: zswap swap-out of large folios" patch-series [1]. This patch propagates the benefits of the above change to page_io.c and vmscan.c. As a result, there is one less reason to have the ifdef THP in these code sections. [1]: https://patchwork.kernel.org/project/linux-mm/list/?series=894347 Signed-off-by: Kanchana P Sridhar Reviewed-by: Nhat Pham --- mm/page_io.c | 2 +- mm/vmscan.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 4aa34862676f..a28d28b6b3ce 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -289,8 +289,8 @@ static inline void count_swpout_vm_event(struct folio *folio) count_memcg_folio_events(folio, THP_SWPOUT, 1); count_vm_event(THP_SWPOUT); } - count_mthp_stat(folio_order(folio), MTHP_STAT_SWPOUT); #endif + count_mthp_stat(folio_order(folio), MTHP_STAT_SWPOUT); count_memcg_folio_events(folio, PSWPOUT, folio_nr_pages(folio)); count_vm_events(PSWPOUT, folio_nr_pages(folio)); } diff --git a/mm/vmscan.c b/mm/vmscan.c index dc7a285b256b..50dc06d55b1d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1257,8 +1257,8 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, THP_SWPOUT_FALLBACK, 1); count_vm_event(THP_SWPOUT_FALLBACK); } - count_mthp_stat(order, MTHP_STAT_SWPOUT_FALLBACK); #endif + count_mthp_stat(order, MTHP_STAT_SWPOUT_FALLBACK); if (!add_to_swap(folio)) goto activate_locked_split; }