linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>
Cc: lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
	rppt@kernel.org, surenb@google.com, mhocko@suse.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Konstantin Khlebnikov <koct9i@gmail.com>
Subject: Re: [PATCH] mm: Strictly check vmstat_text array size
Date: Thu, 29 May 2025 14:16:58 +0200	[thread overview]
Message-ID: <31419fad-89ba-4d97-aeea-ecb6fa5136cf@suse.cz> (raw)
In-Reply-To: <20250529110541.2960330-1-kirill.shutemov@linux.intel.com>

On 5/29/25 13:05, Kirill A. Shutemov wrote:
> The /proc/vmstat displays counters from various sources. It is easy to
> forget to add or remove a label when a new counter is added or removed.
> 
> There is a BUILD_BUG_ON() function that catches missing labels. However,
> for some reason, it ignores extra labels.
> 
> Let's make the check strict. This would help to catch issues when
> a counter is removed.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Konstantin Khlebnikov <koct9i@gmail.com>

Yeah I don't see why it would be necessary to check only for missing labels.

Reviewed-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/vmstat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index ae9882063d89..0903adace423 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1867,7 +1867,7 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
>  	if (*pos >= NR_VMSTAT_ITEMS)
>  		return NULL;
>  
> -	BUILD_BUG_ON(ARRAY_SIZE(vmstat_text) < NR_VMSTAT_ITEMS);
> +	BUILD_BUG_ON(ARRAY_SIZE(vmstat_text) != NR_VMSTAT_ITEMS);
>  	fold_vm_numa_events();
>  	v = kmalloc_array(NR_VMSTAT_ITEMS, sizeof(unsigned long), GFP_KERNEL);
>  	m->private = v;



       reply	other threads:[~2025-05-29 12:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250529110541.2960330-1-kirill.shutemov@linux.intel.com>
2025-05-29 12:16 ` Vlastimil Babka [this message]
2025-05-29 12:26 ` Michal Hocko
2025-05-30  9:50 ` David Hildenbrand

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=31419fad-89ba-4d97-aeea-ecb6fa5136cf@suse.cz \
    --to=vbabka@suse.cz \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=koct9i@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --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