Re: [PATCH RFC 4/4] drivers/base/node: add demote_src and demote_dst to numastat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 02, 2023 at 10:56:48AM +0800, Li Zhijian wrote:
> 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 <lizhijian@xxxxxxxxxxx>
> ---
>  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",

This sysfs file is already a total abuse of sysfs so please, do NOT make
it worse by adding more fields, that's just wrong and something I can
not take at all for obvious reasons.

thanks,

greg k-h




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux