Re: [mmotm:master 301/497] include/linux/mm_types.h:371:22: error: 'HUGE_MAX_HSTATE' undeclared here (not in a function)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 14, 2015 at 07:43:58AM +0800, kbuild test robot wrote:
> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   f6a6014bf6b3c724cff30194681f219ac230c898
> commit: b1e17e02f94bd2dec7547553e3cc5330f497193c [301/497] mm: hugetlb: proc: add HugetlbPages field to /proc/PID/status
> config: sh-sh7785lcr_32bit_defconfig (attached as .config)
> reproduce:
>   wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>   chmod +x ~/bin/make.cross
>   git checkout b1e17e02f94bd2dec7547553e3cc5330f497193c
>   # save the attached .config to linux build tree
>   make.cross ARCH=sh 
> 
> All error/warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/mm.h:16:0,
>                     from arch/sh/kernel/asm-offsets.c:13:
> >> include/linux/mm_types.h:371:22: error: 'HUGE_MAX_HSTATE' undeclared here (not in a function)
>    make[2]: *** [arch/sh/kernel/asm-offsets.s] Error 1
>    make[2]: Target '__build' not remade because of errors.
>    make[1]: *** [prepare0] Error 2
>    make[1]: Target 'prepare' not remade because of errors.
>    make: *** [sub-make] Error 2
> 
> vim +/HUGE_MAX_HSTATE +371 include/linux/mm_types.h
> 
>    365	struct mm_rss_stat {
>    366		atomic_long_t count[NR_MM_COUNTERS];
>    367	};
>    368	
>    369	#ifdef CONFIG_HUGETLB_PAGE
>    370	struct hugetlb_usage {
>  > 371		atomic_long_t count[HUGE_MAX_HSTATE];

When HUGE_MAX_HSTATE is defined in arch-specific code, it's included before
including mm_types.h, so build passes. But if HUGE_MAX_HSTATE is defined in
common code, it's defined in hugetlb.h which is included after mm.h (or
mm_types.h), so this build error happens.

So the fix is simply to move the common definition into mm_types.h.

Thanks,
Naoya Horiguchi
---
Author: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
Date:   Fri Aug 14 09:35:21 2015 +0900

    move HUGE_MAX_HSTATE definition into include/linux/mm_types.h

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 64aa4db01f48..99ea2c651106 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -330,10 +330,6 @@ int __init alloc_bootmem_huge_page(struct hstate *h);
 void __init hugetlb_add_hstate(unsigned order);
 struct hstate *size_to_hstate(unsigned long size);
 
-#ifndef HUGE_MAX_HSTATE
-#define HUGE_MAX_HSTATE 1
-#endif
-
 extern struct hstate hstates[HUGE_MAX_HSTATE];
 extern unsigned int default_hstate_idx;
 
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index e95c5fe1eb7d..27333cdb8b46 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -365,6 +365,10 @@ struct mm_rss_stat {
 };
 
 #ifdef CONFIG_HUGETLB_PAGE
+
+#ifndef HUGE_MAX_HSTATE
+#define HUGE_MAX_HSTATE	1
+#endif
 struct hugetlb_usage {
 	atomic_long_t count[HUGE_MAX_HSTATE];
 };

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]