[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <hwn7s3xjgpfdtvjtnywvv4wwqqxh3ojha7nblp7vy4zfee4epb@25rgcpyhebb5>
Date: Wed, 4 Jun 2025 08:49:12 -0700
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>, lorenzo.stoakes@...cle.com, Liam.Howlett@...cle.com,
vbabka@...e.cz, rppt@...nel.org, surenb@...gle.com, mhocko@...e.com,
hannes@...xchg.org, muchun.song@...ux.dev, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Randy Dunlap <rdunlap@...radead.org>,
Konstantin Khlebnikov <koct9i@...il.com>
Subject: Re: [PATCH] mm/vmstat: Fix build with MEMCG=y and VM_EVENT_COUNTERS=n
On Wed, Jun 04, 2025 at 12:51:11PM +0300, Kirill A. Shutemov wrote:
> When compiling with MEMCG enabled but VM_EVENT_COUNTERS disabled,
> BUILD_BUG_ON() is triggered in vmstat_start because the vmstat_text
> array is larger than NR_VMSTAT_ITEMS.
>
> This issue arises because some elements of the vmstat_text array are
> present when either MEMCG or VM_EVENT_COUNTERS is enabled, but
> NR_VMSTAT_ITEMS only accounts for these elements if VM_EVENT_COUNTERS is
> enabled.
>
> The recent change in the BUILD_BUG_ON() check made it more strict,
> disallowing extra elements in the array, which revealed the issue.
>
> Instead of adjusting the NR_VMSTAT_ITEMS definition to account for
> MEMCG, make MEMCG select VM_EVENT_COUNTERS. VM_EVENT_COUNTERS is
> enabled in most configurations anyway.
>
> There is no need to backport this fix to stable trees. Without the
> strict BUILD_BUG_ON(), the issue is not harmful. The elements in
> question would only be read by the memcg code, not by /proc/vmstat.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Reported-by: Randy Dunlap <rdunlap@...radead.org>
> Fixes: ebc5d83d0443 ("mm/memcontrol: use vmstat names for printing statistics")
> Cc: Konstantin Khlebnikov <koct9i@...il.com>
Acked-by: Shakeel Butt <shakeel.butt@...ux.dev>
Powered by blists - more mailing lists