lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023110230-lilly-mustang-9b57@gregkh>
Date:   Thu, 2 Nov 2023 06:40:12 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Li Zhijian <lizhijian@...itsu.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, rafael@...nel.org,
        linux-mm@...ck.org, ying.huang@...el.com, y-goto@...itsu.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 4/4] drivers/base/node: add demote_src and demote_dst
 to numastat

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@...itsu.com>
> ---
>  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ