From patchwork Fri Nov 1 04:06:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MengEn Sun X-Patchwork-Id: 13858684 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 47AC1E6749A for ; Fri, 1 Nov 2024 04:06:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A0DFF6B009F; Fri, 1 Nov 2024 00:06:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9BE7C6B00A0; Fri, 1 Nov 2024 00:06:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 885C86B00A1; Fri, 1 Nov 2024 00:06:45 -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 697146B009F for ; Fri, 1 Nov 2024 00:06:45 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C518BC19B8 for ; Fri, 1 Nov 2024 04:06:44 +0000 (UTC) X-FDA: 82736189676.28.F08CA09 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf24.hostedemail.com (Postfix) with ESMTP id 39D78180002 for ; Fri, 1 Nov 2024 04:06:39 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iJKWvLkP; spf=pass (imf24.hostedemail.com: domain of mengensun88@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=mengensun88@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730433787; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:dkim-signature; bh=Z6fNV9cqBbjiDhmOMg+ZfjCE9jQFN6pT8SjAyM1Cm5I=; b=XGBT3LjnNZyaUFEJ0zknle7DZEIqzD9ZcAXP+ULc+/EXz4v61Bc71hL3Z40m1Fldq4AC3D MOZOix+8uRjTWq61aMeMa4qyXvpfJrCazmRkx2OXo4wfdFQlsx4yjtc6IxPtRBGj+asFC7 E5XRjZgJn3NglTs0ulV10A5Snccf1Zc= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iJKWvLkP; spf=pass (imf24.hostedemail.com: domain of mengensun88@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=mengensun88@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730433787; a=rsa-sha256; cv=none; b=rzZYqQAHpOSAXfQlQcaqP3KbL8kfa6XrRO2eUQLU0VPxF8tCOwr0bga+7PlIowEAU+CbiP /ow+DdRFJPaM8BNoRDKWhfAp6d1uYGFbkSaI5s2/c0PdcbTyOQovdeznTKeruME2osnD3A uX2PN9MsyiBWZ+gdy4fpb6MhZGTrndw= Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-71ec997ad06so1303772b3a.3 for ; Thu, 31 Oct 2024 21:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730434002; x=1731038802; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z6fNV9cqBbjiDhmOMg+ZfjCE9jQFN6pT8SjAyM1Cm5I=; b=iJKWvLkPdFFwJ+lIYfLghzqMm1y7+TN4JGeAT6QPLEQ9fLTmBQKY3ZpL6bB7xkpq3D IkG2E+myVB7Ga+BHb/K6sgUx6aLMmFLIlQB8+yqqqMz7DuH4eB8YOmnYToTDhdcxJ8lj PtIpXLL8vc6as/vJ9na0B8iR9Ttax3Uu5pr2MM0jUfqVDRpw51aREbDsRnSWsKO00Hx1 FVYxu+Uz7K/fiOP+VCX9HUoNuJ+0cLgKuVqniu9L72ZZ+UEa0H4xIwOf8+PC8jJ2k0ri BnKIT/EFEGz+MWErq0KHRZlsF8LPHpbTA+PQJJuKRHcfX/UYxPYIazFTns8zEFS4eoHJ ZiDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730434002; x=1731038802; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z6fNV9cqBbjiDhmOMg+ZfjCE9jQFN6pT8SjAyM1Cm5I=; b=v6rurYSUsl65kCOP/y7SEw4NG/6H66hvs8hUmMD3RkH+LHds9M4Wa32WwJRvFL/QBt mocg4oA6VK/WtdsGO/QCa03G/MEIQx2XY6WBcEaJ7jl5uVkCCu2BdsWUUc+V9newrqZ0 Q2Csg7I4qr99C3fmMkOOxztRH/x8Sxn96c00p9TtfPSpNMNKMohwtkJt7YkoG2LnzITd XvdwC5j1kp8G2FcttaYF5tw/Q8ktRS7+4b7yA4TOnkTU8otDele9kR1BnQyC6huNCazS Dpnm7P2F4uyVrnn6C5PCo41y42bocNHBCYR729aSN4RJ+HOvUPIcuAojvm2DECdvYSEK A6jg== X-Gm-Message-State: AOJu0YyR2Y5EzMZRXvmLaITtoWUBaUJOrd+h635ZcHwfwIwUawbNzazW FzMJTdiP6Gv3nBQvZ23XHKcVX8tX11/XnRMkBsPHEdYUFiqxczwX X-Google-Smtp-Source: AGHT+IFRZttj0xlmw4OmFxhi0fckSwFgrA7Yr/3PVKMpe0/4OOitM0lPDhLUY1wXX/iIP6DL31PNxA== X-Received: by 2002:a05:6a21:8cc9:b0:1d9:83cd:3d88 with SMTP id adf61e73a8af0-1d9eeb95defmr14112699637.14.1730434001670; Thu, 31 Oct 2024 21:06:41 -0700 (PDT) Received: from localhost.localdomain ([43.153.70.29]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e93daac954sm1958373a91.23.2024.10.31.21.06.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Oct 2024 21:06:41 -0700 (PDT) From: mengensun88@gmail.com X-Google-Original-From: mengensun@tencent.com To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, alexjlzheng@tencent.com, MengEn Sun Subject: [PATCH v2] vmstat: call fold_vm_zone_numa_events() before show per zone NUMA event Date: Fri, 1 Nov 2024 12:06:38 +0800 Message-Id: <1730433998-10461-1-git-send-email-mengensun@tencent.com> X-Mailer: git-send-email 1.8.3.1 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 39D78180002 X-Stat-Signature: miypqdnrgzwyp648gmf7teuh6qzk8phr X-Rspam-User: X-HE-Tag: 1730433999-840483 X-HE-Meta: U2FsdGVkX19u8Q+eke2MBntrh50tF4Vj1PgOdXk74ufxF0kfLEi7zf9IDivUBquHEUrU3xt2eIbPrewQCabAQgWdwmR77olrkirJmheZU71NBYO/bEHZ1N8yWTCb8fuOGzOyPc2nDEpSgelaUIDXapYGPUSnNmK/GM24mhXLVQ5z2MlFWWcFdZFC8+DQckKCPv+IgazI0e9ZANcwY2W6D5/QlHVDCtjwQQCRGgQpa6JMLlQ/ghHX6pxUtEBig6XeP3ssTDwtkRa077rS1xgDwkEw4TbZWdkOV6/lsabzbzQMV+HHkuV0y/YSL4bWOXY3gGDNIAlqM72VLwHL5Xlel0iGKT0uxXhkgANQjunS/LCXfSAOwg6llqsYx5z+TsswZojKcqG+HWs8WAFZRi/xFLh+4IR0NjP+clTEFaCSDoR4mLfLQr5gSCJTnl5/Fmd4WMHRyvCKHTNY+8wQZ5adlQO8wEbSlfkWewf/6y6K6wbdzlEyEDurx6l3vV/Bdyd6X3HZ0QvqP31ivQ0Jokokgjr/ykDmz4+TPGtNe24yJtZCHfG4s1SD2bLm4gsZqsPFse3NeG2zsHi8wBNO/DPkfFVhTvGz/fmo8U21yvoP5N8+urtP4EnF1AXqiJwGqgvnyfHJLLArRcVJlrKY4fwbgJjCJvrqxz4rs5q4WAcImO60//1BO+P9/oDuJeGi2AgcVDMigMP8OeEbcuxVNbN9wLhEgmlYERrzrSEX/eb7WP6WFvxJ7a1o9vumutD7LHstkdCcXR5sPVtAZuOX1zNO+nemFA2rD/+uAbUWqPRJFzM9iFPQxh4nFO1zdZnBzSyyXndM5l+GaIfGg+hDl7X4y2JmgQzZLHOq3oa7xUj2fCepoLevIXYDvqHziMmX2rgNILtW4xdnmg84Nt+qpBKRb91jSRYqWyipuoV5+VIkw3phwkQvAdP862WzsRCzCm5kwnu4Ic4sJIcsK9TI3sm JFIO9Aub iu5Li/voyRyD0Htz0aVVtFhVV0b8Ao4Wt6juZZfRib/bLkMiPK1URoZRkTythryNBMtgzWMF1AuWatxFNajCD0wh/VgNK+cAB/4RBsOQL7Ul1ri9fmBTzNLpC+pVuOK0dtJYkFMpQg0K1vwTkwCrPZPZFpqKZilSJ87Oi16/HFEPjblwMa1VNhvhq7DXapbyi0wsZjV5q6KpfNKVWHT6Ug+5jAvloOOXnb/NMYHSAaQHDyATDox+oSxsZm68I7txPsr0Ig0NWuwiG+UEW1ZYQn5L0GPnQDxrf+pjqlAxx2rsb7/o28H0iXnO8YFLuy4mWZwSa0g3omKnpVFbE6bTdAzMbea+Bmv3+IQgux3qPGmV4WVJ6O7pXGhIIUtL3hKcxbZCfpU2mFZadqTZq72acUCkcF+lPEvTaYZTsqJYkH9WSSYM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000435, 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: MengEn Sun Since 5.14-rc1, NUMA events will only be folded from per-CPU statistics to per zone and global statistics when the user actually needs it. Currently, the kernel has performs the fold operation when reading /proc/vmstat, but does not perform the fold operation in /proc/zoneinfo. This can lead to inaccuracies in the following statistics in zoneinfo: - numa_hit - numa_miss - numa_foreign - numa_interleave - numa_local - numa_other Therefore, before printing per-zone vm_numa_event when reading /proc/zoneinfo, we should also perform the fold operation. Fixes: f19298b9516c ("mm/vmstat: convert NUMA statistics to basic NUMA counters") Reviewed-by: JinLiang Zheng Signed-off-by: MengEn Sun --- changelog: v1: https://lore.kernel.org/linux-mm/20241030163527.cc9075a4aeb60448873aea73@linux-foundation.org/ v2: made some modifications to the commit message: - Made the commit information more detailed - Added the range of versions that need to be fixed. --- mm/vmstat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/vmstat.c b/mm/vmstat.c index b5a4cea..2770800 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1778,6 +1778,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, zone_page_state(zone, i)); #ifdef CONFIG_NUMA + fold_vm_zone_numa_events(zone); for (i = 0; i < NR_VM_NUMA_EVENT_ITEMS; i++) seq_printf(m, "\n %-12s %lu", numa_stat_name(i), zone_numa_event_state(zone, i));