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 EC7C4C2BB41 for ; Tue, 16 Aug 2022 09:16:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 315568D0002; Tue, 16 Aug 2022 05:16:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C4888D0001; Tue, 16 Aug 2022 05:16:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18C9C8D0002; Tue, 16 Aug 2022 05:16:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 074B28D0001 for ; Tue, 16 Aug 2022 05:16:56 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DC17D40517 for ; Tue, 16 Aug 2022 09:16:55 +0000 (UTC) X-FDA: 79804901190.26.E5F2F38 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf05.hostedemail.com (Postfix) with ESMTP id 5914E1001B4 for ; Tue, 16 Aug 2022 09:16:55 +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 ams.source.kernel.org (Postfix) with ESMTPS id B49CEB81600; Tue, 16 Aug 2022 09:16:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05D37C433D6; Tue, 16 Aug 2022 09:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660641412; bh=RCNCXlx7jOfPAXdgaKKdD1Ixni46vQe72pncfwQwk4I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BYM/KPVcKBlfC0RZP2E1ThUWz2FAq7nhixhlQIgpBXSHYhmg5kRYc8/6vL1U5EG0u GM2F99Xwxi/GRJgsF5auG1EmgSmJy46L6781nVIR5y2hAlMlsWQT2iDRR5lF1XDIKb Zd4SCD5Ph79kq6IuXqxeusnXRolJf0rUwYwbZ5/8= Date: Tue, 16 Aug 2022 11:16:49 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220816084426.135528-1-wangkefeng.wang@huawei.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660641415; a=rsa-sha256; cv=none; b=l3Q+uSRhdVFE4nS/wuYjnsX5yUvlCr6qszGX0ksX1kaMRrf4TRFCzoL6xjlyRyPKo0I8Tc i789qWjOBd54ud7siJkVWazO7XTYIkGZ2w5bxfkais9ogsc4TpBRwosEXtJ+l2cibEeEQF bYvPynw5LatsjrxuU6NksmIvh47PH0s= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b="BYM/KPVc"; spf=pass (imf05.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 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=1660641415; 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=ZZTpIuSwGTCQtUwLKpg1ghJKC0iGS9lS/cQlyGmqbOs=; b=kfnpOrMA0BHFNo5EE34SKFTXtG79nLGsNz53dQQIy1StitelSv0q6qcMPeTDf9QxbS/uNg saaduieW9XH/rXN7TlYs4qQbZ7BLktCvjumqbpm0vd2BHBRVaKJJ4mErF9R+0zvsHzUytg hLtuLQ3WBqW1NbauzNF5mP8KsFU2IuA= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5914E1001B4 X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b="BYM/KPVc"; spf=pass (imf05.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org X-Stat-Signature: hwqyzqzbdsxptpo96sdgka5mbwn19h8n X-HE-Tag: 1660641415-620338 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 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. Can you send a patch to do that instead please? thanks, greg k-h