[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZXdAOroKNce1r+TZ@casper.infradead.org>
Date: Mon, 11 Dec 2023 17:00:42 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Pasha Tatashin <pasha.tatashin@...een.com>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org,
akpm@...ux-foundation.org, surenb@...gle.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
souravpanda@...gle.com
Subject: Re: [PATCH] vmstat: don't auto expand the sysfs files
On Mon, Dec 11, 2023 at 03:46:44PM +0000, Pasha Tatashin wrote:
> +++ b/drivers/base/node.c
> @@ -520,26 +520,34 @@ static ssize_t node_read_vmstat(struct device *dev,
> int i;
> int len = 0;
>
> - for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
> - len += sysfs_emit_at(buf, len, "%s %lu\n",
> - zone_stat_name(i),
> - sum_zone_node_page_state(nid, i));
> + for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) {
> + if (vmstat_text[ZONE_STAT_NAME_IDX(i)].flags & VMSTAT_SHOW_SYSFS) {
> + len += sysfs_emit_at(buf, len, "%s %lu\n",
> + zone_stat_name(i),
> + sum_zone_node_page_state(nid, i));
> + }
> + }
This seems overly complicated. Why not do:
for (i = 0; i < NR_VM_ZONE_STAT_SYSFS_ITEMS; i++)
and have assertions that this number doesn't change (and require people
to add to the list after that point)?
Powered by blists - more mailing lists