From mboxrd@z Thu Jan 1 00:00:00 1970 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 7BC83C2BB41 for ; Tue, 16 Aug 2022 10:50:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C396F8D0002; Tue, 16 Aug 2022 06:50:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE91A8D0001; Tue, 16 Aug 2022 06:50:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB0BA8D0002; Tue, 16 Aug 2022 06:50:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 99F4A8D0001 for ; Tue, 16 Aug 2022 06:50:35 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6AB32140730 for ; Tue, 16 Aug 2022 10:50:35 +0000 (UTC) X-FDA: 79805137230.07.F78FC6D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id E78BA801AD for ; Tue, 16 Aug 2022 10:50:34 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1095B61035; Tue, 16 Aug 2022 10:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1D7DC433C1; Tue, 16 Aug 2022 10:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660647033; bh=3Skn3Dxm7mLcgmejceAdOhPccdXPh+grRmHbOhCB8Fo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=R00EOGsCT5xr5Gs01gtbO6VV3r15NkcCu+SgfBkY3+wAUGKEuwXRgT8hBskQeA72z 4o10IryK0TpATyIe4WTIMd18PNbl6HvDPZ5WYUP0E+Ng3fN2vmEEBNal0Z5Q/50oFr Cd7iQ1bc+0eOMHl63e1coLndXnRD+McQQE1R7rEg= Date: Tue, 16 Aug 2022 12:50:30 +0200 From: Greg Kroah-Hartman To: Kefeng Wang Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Liu Shixin Subject: Re: [PATCH RFC] mm, proc: add PcpFree to meminfo Message-ID: References: <20220816084426.135528-1-wangkefeng.wang@huawei.com> <7bdc252f-15dd-8d92-9e08-1ba7dd8308ad@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7bdc252f-15dd-8d92-9e08-1ba7dd8308ad@huawei.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660647035; a=rsa-sha256; cv=none; b=C7FNSquJT9mAYU4T9i/xGa505oxeOiev4Z7v/tyv4fYlyWqJbKr3yFVk/eEYGs51XPSh8P KbjwWgdW3d/FhwLPmiAR78Sbwc037BCXH8y5Vc5cQXI1OC/bvTJZcH9YEZhek3/MfvX0dT 1z7tRwEtYOLiUTIHFB57oQB8u9Ptnro= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=R00EOGsC; spf=pass (imf30.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660647035; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pvWmxHpLbZ63qU9pprfySgOaR5KVthBdlvZXgU0wzMc=; b=yrOvTcfs2QcCa5Wa386GJ2uNVemVoD/yaqAJ3YVS+R8UBGgfIgnNHuoKGX+LFaIymAPhHv j47bmnFC11jsR2EnclDCoAOV7qHia9j8m8Tg0Zw25RzCbjUUo6+Be4K1i4HTPf365dbi56 En5vCyHM6o2jNmwiOWuH7Q66pCGP+y0= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E78BA801AD X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=R00EOGsC; spf=pass (imf30.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org X-Stat-Signature: 3k8kdw55tj378945uaqbo5oggcbzdh1b X-HE-Tag: 1660647034-805129 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: On Tue, Aug 16, 2022 at 06:11:18PM +0800, Kefeng Wang wrote: > > On 2022/8/16 17:16, Greg Kroah-Hartman wrote: > > On Tue, Aug 16, 2022 at 04:44:26PM +0800, Kefeng Wang wrote: > > > From: Liu Shixin > > > > > > The page on pcplist could be used, but not counted into memory free or > > > avaliable, and pcp_free is only showed by show_mem(). Since commit > > > d8a759b57035 ("mm, page_alloc: double zone's batchsize"), there is a > > > significant decrease in the display of free memory, with a large number > > > of cpus and nodes, the number of pages in the percpu list can be very > > > large, so it is better to let user to know the pcp count. > > > > > > Signed-off-by: Liu Shixin > > > Signed-off-by: Kefeng Wang > > > --- > > > drivers/base/node.c | 14 +++++++++++++- > > > fs/proc/meminfo.c | 9 +++++++++ > > > 2 files changed, 22 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/base/node.c b/drivers/base/node.c > > > index eb0f43784c2b..846864e45db6 100644 > > > --- a/drivers/base/node.c > > > +++ b/drivers/base/node.c > > > @@ -375,6 +375,9 @@ static ssize_t node_read_meminfo(struct device *dev, > > > struct sysinfo i; > > > unsigned long sreclaimable, sunreclaimable; > > > unsigned long swapcached = 0; > > > + unsigned long free_pcp = 0; > > > + struct zone *zone; > > > + int cpu; > > > si_meminfo_node(&i, nid); > > > sreclaimable = node_page_state_pages(pgdat, NR_SLAB_RECLAIMABLE_B); > > > @@ -382,9 +385,17 @@ static ssize_t node_read_meminfo(struct device *dev, > > > #ifdef CONFIG_SWAP > > > swapcached = node_page_state_pages(pgdat, NR_SWAPCACHE); > > > #endif > > > + for_each_populated_zone(zone) { > > > + if (zone_to_nid(zone) != nid) > > > + continue; > > > + for_each_online_cpu(cpu) > > > + free_pcp += per_cpu_ptr(zone->per_cpu_pageset, cpu)->count; > > > + } > > > + > > > len = sysfs_emit_at(buf, len, > > > "Node %d MemTotal: %8lu kB\n" > > > "Node %d MemFree: %8lu kB\n" > > > + "Node %d PcpFree: %8lu kB\n" > > First off, this sysfs file is a huge violation of the normal sysfs > > rules, so I will not allow any new entries to be added. In fact, the > > whole thing should just be removed and multiple files created in its > > place. > > Hi Greg, do you mean to remove all /sys/devices/system/node/node*/meminfo, > > but this will beak ABI, is it acceptable? I do not know, what tool relies on this file? Any userspace tool should always be able to handle a sysfs file being removed, so you should probably work with the tool authors to fix this up before removing it. thanks, gre gk-h