On Thu, May 29, 2025 at 12:40:21PM +0200, Vlastimil Babka wrote:
On 5/29/25 12:38, Kirill A. Shutemov wrote:
Hongyu noticed that the nr_unaccepted counter kept growing even in the absence of unaccepted memory on the machine.
This happens due to a commit that removed NR_BOUNCE: it removed the counter from the enum zone_stat_item, but left it in the vmstat_text array.
As a result, all counters below nr_bounce in /proc/vmstat are shifted by one line, causing the numa_hit counter to be labeled as nr_unaccepted.
To fix this issue, remove nr_bounce from the vmstat_text array.
Signed-off-by: Kirill A. Shutemov kirill.shutemov@linux.intel.com Reported-by: Hongyu Ning hongyu.ning@linux.intel.com Fixes: 194df9f66db8 ("mm: remove NR_BOUNCE zone stat") Cc: stable@vger.kernel.org Cc: Christoph Hellwig hch@lst.de Cc: Hannes Reinecke hare@suse.de Cc: Johannes Thumshirn johannes.thumshirn@wdc.com Cc: Jens Axboe axboe@kernel.dk
Is there a way to add a BUILD_BUG_ON to catch a future case like this one?
There's
BUILD_BUG_ON(ARRAY_SIZE(vmstat_text) < NR_VMSTAT_ITEMS);
in vmstat_start().
Making it strict != seems to do the trick for my config. But it requires wider testing.
I can prepare a patch for that.