From patchwork Thu Nov 2 02:56:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zhijian X-Patchwork-Id: 13443346 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 D147CC4167D for ; Thu, 2 Nov 2023 02:57:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BD948E0015; Wed, 1 Nov 2023 22:57:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 647168E0009; Wed, 1 Nov 2023 22:57:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C1778E0015; Wed, 1 Nov 2023 22:57:37 -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 3D3028E0009 for ; Wed, 1 Nov 2023 22:57:37 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 19AFD120DE2 for ; Thu, 2 Nov 2023 02:57:37 +0000 (UTC) X-FDA: 81411503754.22.3833BC3 Received: from esa11.hc1455-7.c3s2.iphmx.com (esa11.hc1455-7.c3s2.iphmx.com [207.54.90.137]) by imf28.hostedemail.com (Postfix) with ESMTP id B9939C001A for ; Thu, 2 Nov 2023 02:57:34 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=fujitsu.com; spf=pass (imf28.hostedemail.com: domain of lizhijian@fujitsu.com designates 207.54.90.137 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=1698893855; 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=+2lMwW7x0CNbqVvfeKF1nYASQsLMHIaL2xereHi1onc=; b=1mjTfgenjIN7x6XbuW+h3o3JS8mZRiG2Eg8Z/QmsgtcMuw6sd/f9Hpl8dSl/6486KqjU/V G5OidtJU0EyxHdZV8vSdcCMnKOqP6WHVrxiZgdoKAh7BOIqxRMboWm0YjN3689jYBQUcgV BnonwV+BvWtawYRZj0vkclEmFVGWTDM= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=fujitsu.com; spf=pass (imf28.hostedemail.com: domain of lizhijian@fujitsu.com designates 207.54.90.137 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698893855; a=rsa-sha256; cv=none; b=G8h8eydgsX0xawulsMP9U6hmgNFL4ArpL2u30LT36FX6bKgGmB9/UdzKsoY1fw/iR1Z4s/ MYmWk6EiexjjzJutII2IJRmfhSWePGxIDJjQgaOnyn5pEueU+u+va3bgMS0/R3lSUN9IG/ tBJG/3CG6NrD3SLNzQ+KQtrx5mKi6To= X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="117752860" X-IronPort-AV: E=Sophos;i="6.03,270,1694703600"; d="scan'208";a="117752860" Received: from unknown (HELO yto-r3.gw.nic.fujitsu.com) ([218.44.52.219]) by esa11.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 11:57:00 +0900 Received: from yto-m4.gw.nic.fujitsu.com (yto-nat-yto-m4.gw.nic.fujitsu.com [192.168.83.67]) by yto-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 5D66AD5026 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 yto-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id 8A5CFD3F38 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 19724200649DE for ; Thu, 2 Nov 2023 11:56:55 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 966A41A0071; 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 4/4] drivers/base/node: add demote_src and demote_dst to numastat Date: Thu, 2 Nov 2023 10:56:48 +0800 Message-Id: <20231102025648.1285477-5-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--2.607700-10.000000 X-TMASE-MatchedRID: RtHHqK+8YWMx3g1BjbXsyArcxrzwsv5u5bMmdOYs/G/rix/QSCPuKr8F Hrw7frluf146W0iUu2tDc4lSgrowpdTgNUieJDkRSs47mbT7SARSuvtBzlaEqE+la3/T6ykP3YW HdXsKykrMyBGHVXFUDoAy6p60ZV62fJ5/bZ6npdjGVuWouVipcljVOVbGM+bZD1Vdt6kw28OKCz o1BkkvYAIiqmLQ6JLHOV0z0B/FQt8PnX3Fui/kjKo9VQLNxdGdSpvPBwsoXEYd/XNGPTZXaRFlt GxCTkwFQHVA+r1vGdZmQDEDCMiuswfP8fSSIvISoYC0cwOOST0= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Rspam-User: X-Stat-Signature: xx8xu6aauoje5uda8hq89zcpi5rpxxta X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B9939C001A X-HE-Tag: 1698893854-631595 X-HE-Meta: U2FsdGVkX19NXQeyJKmEWrrHHwOnPy75/S1HWaxgaHja6NrdU+Cq3u4ihQXlXD42gq6vUWkqJaWfxKcQa1Mq8bUGLJSySzohsDFl7AT3jVKnQPastd8XX5oUxU9etKTHlZITgcLYuRFIyh+VPwtoXVrQpn6tcpZjgQQwkTMg45tH0EMK62xdCgVwF5wfFKqUkw/uP+2hxJh0oekDGrwXfZwO7PkLvXphTmdlWHjLP5NkytK6kt+CfReqtsBkSl6yHMfeVx2jkZ0CIzUm/P7skiTZbRoCSipVRGBoDiMno9F/Ybv+kcYNXZKh07uXhAGJ/opXjUxE4uqyGWDPnEGNYgZhrAassS6eyr+UTiA+zcAjZ5Ahnw64YDXELn/KjPDcuH7rdjEwHPZZkiH9bgmjzi8Yk0YLPWKW13BlE+mwGkgS/7XGPWRldc649TvHln3AlT2Joy79iFFzWdtYF7uFjN5dtYJgICGPPs0CFD1AuVXVBXW/LlvJ+GhHwTexgeY3Kxsj5e4Krz+4j5Zp8NQiqjgLGxoE/MVA/ywjyyQ0DuQLxUj1+vQfrrYYWL0fK+SnkXtUR7Wjd70gy/WTHohCRqvtHD1trNonnXd7WZ/tS3t7RuildU3aSXD32ve8COMu/hldK522CSVxJp1L4Y2qgAI8JtDxRpoHjmdMazlJnomkC9SL7Ob5hZsF+bvK6LZdMu5APef/WmrR8awQDGLwE3EN58/vmDqqjbjWkRahNVRZ7HWysPP48bKlkKPXQ7hhOaFfFcJuukq7yFStc7N7ndIRTJOWwaKUguqhlPb6gKbfFSm6hviA/JEThawuzvczsXPWZZrSME+7/YMSqQ7SRf0R02plJXLgszgU2VcYPWyh8+VK/bRWf0lJ6/UEQ9zvFk82P+E/SRKVi2wD6B0aDB6CLTBb0r5W3BqwJFSGd+pYStqlcU9W9QUQviwzsg1dG0QnmUAgsD6fRHpDmt2 3YLSdXgx jnSOFY+6FBHzHFnFGE450NesZOqr+blm/OlNkqJIj1x7NoAdzLvddX4gN59/nXJ00j54KMQUcmmx9ZriCIbbiNQRjTy4jHw/w5dqNAN93kBLhnFUPMjcAbDOpfgcICl2t40mdKldqh0OrItg7rY4EQeXNCqKMkbMEy+KBKrX47Iw6rOq9nzmMfvb+/QNloyeZdSq9agbCAWI0ipE= 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: node0 and node1 is DRAM node, node3 is a PMEM node. $ cat /sys/devices/system/node/node1/numastat numa_hit 646590 numa_miss 3963 numa_foreign 30651 interleave_hit 416 local_node 645252 other_node 5301 demote_src 200478 demote_dst 0 Of cousre, the userspace numastat will be extened to support these 2 new fields in the future like: $ numastat node0 node1 node3 numa_hit 741793 702460 364154 numa_miss 1759 8104 28893 numa_foreign 8105 30651 0 interleave_hit 653 416 0 local_node 741762 701115 0 other_node 1790 9449 393047 demote_src 163612 203828 0 demote_dst 0 0 367440 Signed-off-by: Li Zhijian --- drivers/base/node.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index 27e8502548a7..d3fc70599b6a 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -496,20 +496,32 @@ static DEVICE_ATTR(meminfo, 0444, node_read_meminfo, NULL); static ssize_t node_read_numastat(struct device *dev, struct device_attribute *attr, char *buf) { + struct pglist_data *pgdat = NODE_DATA(dev->id); + unsigned long demote_src, demote_dst; + fold_vm_numa_events(); + demote_src = node_page_state_pages(pgdat, PGDEMOTE_SRC_KSWAPD) + + node_page_state_pages(pgdat, PGDEMOTE_SRC_DIRECT) + + node_page_state_pages(pgdat, PGDEMOTE_SRC_KHUGEPAGED); + demote_dst = node_page_state_pages(pgdat, PGDEMOTE_DST_KSWAPD) + + node_page_state_pages(pgdat, PGDEMOTE_DST_DIRECT) + + node_page_state_pages(pgdat, PGDEMOTE_DST_KHUGEPAGED); return sysfs_emit(buf, "numa_hit %lu\n" "numa_miss %lu\n" "numa_foreign %lu\n" "interleave_hit %lu\n" "local_node %lu\n" - "other_node %lu\n", + "other_node %lu\n" + "demote_src %lu\n" + "demote_dst %lu\n", sum_zone_numa_event_state(dev->id, NUMA_HIT), sum_zone_numa_event_state(dev->id, NUMA_MISS), sum_zone_numa_event_state(dev->id, NUMA_FOREIGN), sum_zone_numa_event_state(dev->id, NUMA_INTERLEAVE_HIT), sum_zone_numa_event_state(dev->id, NUMA_LOCAL), - sum_zone_numa_event_state(dev->id, NUMA_OTHER)); + sum_zone_numa_event_state(dev->id, NUMA_OTHER), + demote_src, demote_dst); } static DEVICE_ATTR(numastat, 0444, node_read_numastat, NULL);