linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: gregkh@linuxfoundation.org, rafael@kernel.org,
	akpm@linux-foundation.org, surenb@google.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	souravpanda@google.com
Subject: Re: [PATCH] vmstat: don't auto expand the sysfs files
Date: Mon, 11 Dec 2023 17:00:42 +0000	[thread overview]
Message-ID: <ZXdAOroKNce1r+TZ@casper.infradead.org> (raw)
In-Reply-To: <20231211154644.4103495-1-pasha.tatashin@soleen.com>

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)?


  reply	other threads:[~2023-12-11 17:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 15:46 Pasha Tatashin
2023-12-11 17:00 ` Matthew Wilcox [this message]
2023-12-11 17:09   ` Pasha Tatashin
2023-12-14 17:52 ` David Rientjes
2023-12-14 18:57   ` Pasha Tatashin
2023-12-24 21:26     ` David Rientjes
2023-12-26 17:26       ` Pasha Tatashin
2023-12-27  0:53         ` Sysfs one-value-per-file (was Re: [PATCH] vmstat: don't auto expand the sysfs files) David Rientjes
2023-12-27 18:42           ` Andrew Morton
2023-12-28 14:48             ` Pasha Tatashin
2023-12-28 20:43               ` David Rientjes
2023-12-28 20:50                 ` Pasha Tatashin
2023-12-28 10:17           ` Greg Kroah-Hartman
2023-12-28 20:52             ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZXdAOroKNce1r+TZ@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=rafael@kernel.org \
    --cc=souravpanda@google.com \
    --cc=surenb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox