Skip to content

Commit 94d46bf

Browse files
Barry Songakpm00
authored andcommitted
mm: huge_mm: fix undefined reference to `mthp_stats' for CONFIG_SYSFS=n
if CONFIG_SYSFS is not enabled in config, we get the below error, All errors (new ones prefixed by >>): s390-linux-ld: mm/memory.o: in function `count_mthp_stat': >> include/linux/huge_mm.h:285:(.text+0x191c): undefined reference to `mthp_stats' s390-linux-ld: mm/huge_memory.o:(.rodata+0x10): undefined reference to `mthp_stats' vim +285 include/linux/huge_mm.h 279 280 static inline void count_mthp_stat(int order, enum mthp_stat_item item) 281 { 282 if (order <= 0 || order > PMD_ORDER) 283 return; 284 > 285 this_cpu_inc(mthp_stats.stats[order][item]); 286 } 287 Link: https://lkml.kernel.org/r/[email protected] Fixes: ec33687 ("mm: add per-order mTHP anon_fault_alloc and anon_fault_fallback counters") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Barry Song <[email protected]> Tested-by: Yujie Liu <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 0d648dd commit 94d46bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/linux/huge_mm.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ struct mthp_stat {
278278
unsigned long stats[ilog2(MAX_PTRS_PER_PTE) + 1][__MTHP_STAT_COUNT];
279279
};
280280

281+
#ifdef CONFIG_SYSFS
281282
DECLARE_PER_CPU(struct mthp_stat, mthp_stats);
282283

283284
static inline void count_mthp_stat(int order, enum mthp_stat_item item)
@@ -287,6 +288,11 @@ static inline void count_mthp_stat(int order, enum mthp_stat_item item)
287288

288289
this_cpu_inc(mthp_stats.stats[order][item]);
289290
}
291+
#else
292+
static inline void count_mthp_stat(int order, enum mthp_stat_item item)
293+
{
294+
}
295+
#endif
290296

291297
#define transparent_hugepage_use_zero_page() \
292298
(transparent_hugepage_flags & \

0 commit comments

Comments
 (0)