lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH RFC] mm, proc: add PcpFree to meminfo
From

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 <liushixin2@huawei.com>
>>
>> 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 <liushixin2@huawei.com>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>> 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?

>
> Can you send a patch to do that instead please?
>
> thanks,
>
> greg k-h
> .

\
 
 \ /
  Last update: 2022-08-16 13:00    [W:0.085 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site