From patchwork Thu Nov 2 02:56:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13443344 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 6662EC4332F for ; Thu, 2 Nov 2023 02:57:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED3B58E0013; Wed, 1 Nov 2023 22:57:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5C8F8E0009; Wed, 1 Nov 2023 22:57:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD6EF8E0013; Wed, 1 Nov 2023 22:57:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BDC078E0009 for ; Wed, 1 Nov 2023 22:57:19 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9E6AF160E35 for ; Thu, 2 Nov 2023 02:57:19 +0000 (UTC) X-FDA: 81411502998.30.760EA29 Received: from esa8.hc1455-7.c3s2.iphmx.com (esa8.hc1455-7.c3s2.iphmx.com [139.138.61.253]) by imf09.hostedemail.com (Postfix) with ESMTP id 4E7BD140017 for ; Thu, 2 Nov 2023 02:57:17 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=fujitsu.com; spf=pass (imf09.hostedemail.com: domain of lizhijian@fujitsu.com designates 139.138.61.253 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698893837; 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:in-reply-to:references:references; bh=J9rftE7hC3AGyugrT+zGRfxywtEI4OKPAOoaaDlpups=; b=bdI9yPEKjobF0o5EgDyAp+3mRLHt35t443OtR8tzPvIkQP5wraA8SQKr9vDpGNSbfii+sr GwOCLuf+hHMhpj5VDnNcQlHtFRErTstpFLGaBjiE3I9y1zzFrADXPBiIdd/G8B8+NnGKjV Kb86is2M7pI81fgAWL921s22su89CFs= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=fujitsu.com; spf=pass (imf09.hostedemail.com: domain of lizhijian@fujitsu.com designates 139.138.61.253 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698893837; a=rsa-sha256; cv=none; b=mtGL9tEJwkxWfCpAab9OT3sBh4rs0p4zhwS793VanTygocuXF6E0rfDIW8TzrycMaCrx/i +ufj80vxans0yMTcXtketFIKt3N7z4q5I0nrKQOgqIfHABk3HdT266WuRx+bAWiUxSexcc 2iR+0/S0nrbRx/6EPChWL8/kO56PUDI= X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="126346049" X-IronPort-AV: E=Sophos;i="6.03,270,1694703600"; d="scan'208";a="126346049" Received: from unknown (HELO oym-r2.gw.nic.fujitsu.com) ([210.162.30.90]) by esa8.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 11:56:58 +0900 Received: from oym-m1.gw.nic.fujitsu.com (oym-nat-oym-m1.gw.nic.fujitsu.com [192.168.87.58]) by oym-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id 0A13CD7AD5 for ; Thu, 2 Nov 2023 11:56:56 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 35BB7D4F41 for ; Thu, 2 Nov 2023 11:56:55 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id B6C71200649E5 for ; Thu, 2 Nov 2023 11:56:54 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 3D48C1A0072; Thu, 2 Nov 2023 10:56:54 +0800 (CST) From: Li Zhijian To: Andrew Morton , Greg Kroah-Hartman , rafael@kernel.org, linux-mm@kvack.org Cc: ying.huang@intel.com, y-goto@fujitsu.com, linux-kernel@vger.kernel.org, Li Zhijian Subject: [PATCH RFC 3/4] mm/vmstat: rename pgdemote_* to pgdemote_dst_* and add pgdemote_src_* Date: Thu, 2 Nov 2023 10:56:47 +0800 Message-Id: <20231102025648.1285477-4-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231102025648.1285477-1-lizhijian@fujitsu.com> References: <20231102025648.1285477-1-lizhijian@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-27972.004 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-27972.004 X-TMASE-Result: 10--0.044700-10.000000 X-TMASE-MatchedRID: s7S5NEjjqbJeDnPFO4EAX6EtILqFekmXGfZImb3fqAQG8XHns3ektTav Mpat2LKScNc4kvlfJCumDMVCgYQw4WeGWtJU0LwEuce7gFxhKa3BOVz0Jwcxl6vCrG0TnfVUEW6 ngIg0fckNkUi7wot1qoBStp5jwgJ5HxPMjOKY7A8LbigRnpKlKZx+7GyJjhAURc10OyDCZOyvXC vTsSnc8vUNzlSa+LRUIgjmxj8SpgVHij2FA3ms0pcYgvsapcWoAmnHtTPu1k0l4uLbbTGSgQrwF gFFpdiXmw0Qaktp+ussz+cQMs/Tnp75MOLIf/j3DF+QsB+Q01JoBmTSwRxjXg== X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Rspam-User: X-Stat-Signature: tabsuhafdar7nccdbnoz7gjwfxk36uff X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4E7BD140017 X-HE-Tag: 1698893837-754509 X-HE-Meta: U2FsdGVkX18zw10EGwSs9CXSunYg9/vHSiozfbGdnA4pjUG6Z5Syi8DHr6mgjKvhzjKhuGmpc9G9eLK06aZ+YTa4i1+piB0C9+baB4rNitrdyIvwbGA8iN/qVFyGVQLya8LFZAXzMaye7PCAEpFvGqxkLg/lGDtNRDXxxsyoA5PibBgp9+eC1E88tQoTTmFGrhlOpITz1++NaSRl56hmGFZGMqvMum07A0kXUvUGh5gbS+pDG2ku0NxzPdvijYHQkHc3zTU4mrtWlSaocxcnOzJgTlZc2tTk0Wq1VlIp9mZ58qER7A21Yn2r4gXJJIJsif2qKM5Gxwhhyp+72rAMcNaaO9nd2xeD1R4PmkgB9PxEbxy0njNno3R6sbXFt0oQSFX3pbB7O1iZzZ2CaqLGKxQ/P89jhKtKu2ZojqwC30Ra7iJpkvIma5dMhQznpNMUMzFXdkStc9Dl9d1D43c80MSecM8kTZcPp82XfFPMkRkAr6MzrroQX48oanVJ8eT2wKxnpt27KwKIvxnRlotTyVJhs32mDk2pUuBwoKruzk5pOns7Xq8qhGw9PzMnLk+3YO/0G1TIvlCW5yFCWQX1TL8byHb2hXX3h2+WXaV5VmdQWHmKiqyCG6X7C5p+XtFinw6UF6iSpMXjihplh4m/ZaAnu3X5XqTFVMNtw/D/9R0K9/VGANPJgD+iwnBbSJTnvOabeNx0PZWawQC+HfThjiHw+km0mA6nM6TvgbgZcDXo6SbcCVCrNHAqERe8cDENLhuzVhy7FclLSFrd0NIBMjOjit6aYEduWJ0pqSym2nnLGTBY4r5KlOsB65HXqrH/7f4dh1h3rQiPSpt2l91CaCybLnz1BBneBTpzLhrcWQx5EnJV9Xz6WvEicYf2zkO/nlJusNerhynP8t8w69A3cmnbGhTZnHfGelSfrQ2v9k2MwtYRnVtUy0jc1HkMFVUBQ4JVouBwlm0qRixmmgn Ubi50Gjp 5NfUC8jOEEylq/85reRTAiQ/Bbg4qPe2Pq2N1LI6LMWiEQhhNXGgx3WMEEGRxTLPlyXoBV6Io47HglV29VpLm52d9FjNWY9adrCQJ8V7NiZcyb9BfCslFcKURPFCMfWAquB8BtSfGwq9Q9AXRB34jT8ct2S9MZYxx+QCCw/mD7nTVUzCzQQ43hxIIv+hNvijynjOtJfZKvFWDZAc= 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: pgdemote_src_*: pages demoted from this node. pgdemote_dst_*: pages demoted to this node. So that we are able to know their demotion per-node stats by checking this. In the environment, node0 and node1 are DRAM, node3 is PMEM. Global stats: $ grep -E 'demote' /proc/vmstat pgdemote_src_kswapd 130155 pgdemote_src_direct 113497 pgdemote_src_khugepaged 0 pgdemote_dst_kswapd 130155 pgdemote_dst_direct 113497 pgdemote_dst_khugepaged 0 Per-node stats: $ grep demote /sys/devices/system/node/node0/vmstat pgdemote_src_kswapd 68454 pgdemote_src_direct 83431 pgdemote_src_khugepaged 0 pgdemote_dst_kswapd 0 pgdemote_dst_direct 0 pgdemote_dst_khugepaged 0 $ grep demote /sys/devices/system/node/node1/vmstat pgdemote_src_kswapd 185834 pgdemote_src_direct 30066 pgdemote_src_khugepaged 0 pgdemote_dst_kswapd 0 pgdemote_dst_direct 0 pgdemote_dst_khugepaged 0 $ grep demote /sys/devices/system/node/node3/vmstat pgdemote_src_kswapd 0 pgdemote_src_direct 0 pgdemote_src_khugepaged 0 pgdemote_dst_kswapd 254288 pgdemote_dst_direct 113497 pgdemote_dst_khugepaged 0 From above stats, we know node3 is the demotion destination which one the node0 and node1 will demote to. Signed-off-by: Li Zhijian --- RFC: their names are open to discussion, maybe pgdemote_from/to_* Another defect of this patch is that, SUM(pgdemote_src_*) is always same as SUM(pgdemote_dst_*) in the global stats, shall we hide one of them. --- include/linux/mmzone.h | 9 ++++++--- mm/vmscan.c | 13 ++++++++++--- mm/vmstat.c | 9 ++++++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index ad0309eea850..a6140d894bec 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -207,9 +207,12 @@ enum node_stat_item { PGPROMOTE_SUCCESS, /* promote successfully */ PGPROMOTE_CANDIDATE, /* candidate pages to promote */ /* PGDEMOTE_*: pages demoted */ - PGDEMOTE_KSWAPD, - PGDEMOTE_DIRECT, - PGDEMOTE_KHUGEPAGED, + PGDEMOTE_SRC_KSWAPD, + PGDEMOTE_SRC_DIRECT, + PGDEMOTE_SRC_KHUGEPAGED, + PGDEMOTE_DST_KSWAPD, + PGDEMOTE_DST_DIRECT, + PGDEMOTE_DST_KHUGEPAGED, #endif NR_VM_NODE_STAT_ITEMS }; diff --git a/mm/vmscan.c b/mm/vmscan.c index 2f1fb4ec3235..55d2287d7150 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1111,13 +1111,18 @@ void drop_slab(void) static int reclaimer_offset(void) { BUILD_BUG_ON(PGSTEAL_DIRECT - PGSTEAL_KSWAPD != - PGDEMOTE_DIRECT - PGDEMOTE_KSWAPD); + PGDEMOTE_SRC_DIRECT - PGDEMOTE_SRC_KSWAPD); BUILD_BUG_ON(PGSTEAL_DIRECT - PGSTEAL_KSWAPD != PGSCAN_DIRECT - PGSCAN_KSWAPD); BUILD_BUG_ON(PGSTEAL_KHUGEPAGED - PGSTEAL_KSWAPD != - PGDEMOTE_KHUGEPAGED - PGDEMOTE_KSWAPD); + PGDEMOTE_SRC_KHUGEPAGED - PGDEMOTE_SRC_KSWAPD); BUILD_BUG_ON(PGSTEAL_KHUGEPAGED - PGSTEAL_KSWAPD != PGSCAN_KHUGEPAGED - PGSCAN_KSWAPD); + BUILD_BUG_ON(PGDEMOTE_SRC_DIRECT - PGDEMOTE_SRC_KSWAPD != + PGDEMOTE_DST_DIRECT - PGDEMOTE_DST_KSWAPD); + BUILD_BUG_ON(PGDEMOTE_SRC_KHUGEPAGED - PGDEMOTE_SRC_KSWAPD != + PGDEMOTE_DST_KHUGEPAGED - PGDEMOTE_DST_KSWAPD); + if (current_is_kswapd()) return 0; @@ -1678,8 +1683,10 @@ static unsigned int demote_folio_list(struct list_head *demote_folios, (unsigned long)&mtc, MIGRATE_ASYNC, MR_DEMOTION, &nr_succeeded); + mod_node_page_state(pgdat, + PGDEMOTE_SRC_KSWAPD + reclaimer_offset(), nr_succeeded); mod_node_page_state(NODE_DATA(target_nid), - PGDEMOTE_KSWAPD + reclaimer_offset(), nr_succeeded); + PGDEMOTE_DST_KSWAPD + reclaimer_offset(), nr_succeeded); return nr_succeeded; } diff --git a/mm/vmstat.c b/mm/vmstat.c index f141c48c39e4..63f106a5e008 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1244,9 +1244,12 @@ const char * const vmstat_text[] = { #ifdef CONFIG_NUMA_BALANCING "pgpromote_success", "pgpromote_candidate", - "pgdemote_kswapd", - "pgdemote_direct", - "pgdemote_khugepaged", + "pgdemote_src_kswapd", + "pgdemote_src_direct", + "pgdemote_src_khugepaged", + "pgdemote_dst_kswapd", + "pgdemote_dst_direct", + "pgdemote_dst_khugepaged", #endif /* enum writeback_stat_item counters */