[RFC PATCH -next] mm/vmstat: Fix build error without CONFIG_VM_EVENT_COUNTERS

From: YueHaibing
Date: Tue Oct 22 2019 - 08:52:32 EST


If CONFIG_VM_EVENT_COUNTERS is n but CONFIG_MEMCG is y,
vmstat_text is not equal stat_items_size:

mm/vmstat.c: In function vmstat_start:
./include/linux/compiler.h:350:38: error: call to __compiletime_assert_1659 declared
with attribute error: BUILD_BUG_ON failed: stat_items_size != ARRAY_SIZE(vmstat_text) * sizeof(unsigned long)
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)

Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Fixes: 2fdf561910a9 ("mm/memcontrol: use vmstat names for printing statistics")
Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
---
mm/vmstat.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index b2fd344..a19ed6e 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1655,8 +1655,6 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
stat_items_size += sizeof(struct vm_event_state);
#endif

- BUILD_BUG_ON(stat_items_size !=
- ARRAY_SIZE(vmstat_text) * sizeof(unsigned long));
v = kmalloc(stat_items_size, GFP_KERNEL);
m->private = v;
if (!v)
--
2.7.4