Re: [PATCH v3 06/14] linux/mm.h: move folio_size(), ... to mm/folio_size.h

From: kernel test robot
Date: Thu Mar 07 2024 - 10:56:16 EST


Hi Max,

kernel test robot noticed the following build errors:

[auto build test ERROR on next-20240305]
[cannot apply to akpm-mm/mm-everything char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus joro-iommu/next broonie-spi/for-next powerpc/next powerpc/fixes linus/master v6.8-rc7 v6.8-rc6 v6.8-rc5 v6.8-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/drivers-add-missing-includes-on-linux-mm-h-and-others/20240305-170312
base: next-20240305
patch link: https://lore.kernel.org/r/20240305085919.1601395-7-max.kellermann%40ionos.com
patch subject: [PATCH v3 06/14] linux/mm.h: move folio_size(), ... to mm/folio_size.h
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20240307/202403072311.1a9jXzWI-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240307/202403072311.1a9jXzWI-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403072311.1a9jXzWI-lkp@xxxxxxxxx/

All error/warnings (new ones prefixed by >>):

In file included from include/linux/mm/folio_size.h:8,
from include/linux/mm.h:5,
from arch/loongarch/include/asm/vdso.h:10,
from arch/loongarch/vdso/vgetcpu.c:6:
>> include/linux/page-flags.h:202:1: warning: data definition has no type or storage class
202 | DECLARE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key);
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/page-flags.h:202:1: error: type defaults to 'int' in declaration of 'DECLARE_STATIC_KEY_FALSE' [-Werror=implicit-int]
>> include/linux/page-flags.h:202:1: warning: parameter names (without types) in function declaration
In file included from include/linux/mm/folio_size.h:8,
from include/linux/mm.h:5,
from arch/loongarch/include/asm/vdso.h:10,
from arch/loongarch/include/asm/vdso/vdso.h:11,
from arch/loongarch/include/asm/vdso/gettimeofday.h:13,
from include/vdso/datapage.h:151,
from lib/vdso/gettimeofday.c:5,
from <command-line>:
>> include/linux/page-flags.h:202:1: warning: data definition has no type or storage class
202 | DECLARE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key);
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/page-flags.h:202:1: error: type defaults to 'int' in declaration of 'DECLARE_STATIC_KEY_FALSE' [-Werror=implicit-int]
>> include/linux/page-flags.h:202:1: warning: parameter names (without types) in function declaration
include/linux/page-flags.h: In function 'page_fixed_fake_head':
>> include/linux/page-flags.h:210:14: error: implicit declaration of function 'static_branch_unlikely' [-Werror=implicit-function-declaration]
210 | if (!static_branch_unlikely(&hugetlb_optimize_vmemmap_key))
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/page-flags.h: In function 'page_fixed_fake_head':
>> include/linux/page-flags.h:210:14: error: implicit declaration of function 'static_branch_unlikely' [-Werror=implicit-function-declaration]
210 | if (!static_branch_unlikely(&hugetlb_optimize_vmemmap_key))
| ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/page-flags.h:210:38: error: 'hugetlb_optimize_vmemmap_key' undeclared (first use in this function)
210 | if (!static_branch_unlikely(&hugetlb_optimize_vmemmap_key))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/page-flags.h:210:38: note: each undeclared identifier is reported only once for each function it appears in
>> include/linux/page-flags.h:210:38: error: 'hugetlb_optimize_vmemmap_key' undeclared (first use in this function)
210 | if (!static_branch_unlikely(&hugetlb_optimize_vmemmap_key))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/page-flags.h:210:38: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:244: arch/loongarch/vdso/vgetcpu.o] Error 1
make[3]: *** [scripts/Makefile.build:244: arch/loongarch/vdso/vgettimeofday.o] Error 1
make[3]: Target 'include/generated/vdso-offsets.h' not remade because of errors.
make[2]: *** [arch/loongarch/Makefile:163: vdso_prepare] Error 2
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:240: __sub-make] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:240: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.


vim +202 include/linux/page-flags.h

9223b4190fa129 Christoph Lameter 2008-04-28 200
47010c040dec8a Muchun Song 2022-04-28 201 #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
cf5472e5611338 Muchun Song 2022-06-28 @202 DECLARE_STATIC_KEY_FALSE(hugetlb_optimize_vmemmap_key);
a6b40850c442bf Muchun Song 2022-03-22 203
e7d324850bfcb3 Muchun Song 2022-03-22 204 /*
838691a1c0ec44 Muchun Song 2022-06-28 205 * Return the real head page struct iff the @page is a fake head page, otherwise
838691a1c0ec44 Muchun Song 2022-06-28 206 * return the @page itself. See Documentation/mm/vmemmap_dedup.rst.
e7d324850bfcb3 Muchun Song 2022-03-22 207 */
e7d324850bfcb3 Muchun Song 2022-03-22 208 static __always_inline const struct page *page_fixed_fake_head(const struct page *page)
e7d324850bfcb3 Muchun Song 2022-03-22 209 {
cf5472e5611338 Muchun Song 2022-06-28 @210 if (!static_branch_unlikely(&hugetlb_optimize_vmemmap_key))
e7d324850bfcb3 Muchun Song 2022-03-22 211 return page;
e7d324850bfcb3 Muchun Song 2022-03-22 212
e7d324850bfcb3 Muchun Song 2022-03-22 213 /*
e7d324850bfcb3 Muchun Song 2022-03-22 214 * Only addresses aligned with PAGE_SIZE of struct page may be fake head
e7d324850bfcb3 Muchun Song 2022-03-22 215 * struct page. The alignment check aims to avoid access the fields (
e7d324850bfcb3 Muchun Song 2022-03-22 216 * e.g. compound_head) of the @page[1]. It can avoid touch a (possibly)
e7d324850bfcb3 Muchun Song 2022-03-22 217 * cold cacheline in some cases.
e7d324850bfcb3 Muchun Song 2022-03-22 218 */
e7d324850bfcb3 Muchun Song 2022-03-22 219 if (IS_ALIGNED((unsigned long)page, PAGE_SIZE) &&
e7d324850bfcb3 Muchun Song 2022-03-22 220 test_bit(PG_head, &page->flags)) {
e7d324850bfcb3 Muchun Song 2022-03-22 221 /*
e7d324850bfcb3 Muchun Song 2022-03-22 222 * We can safely access the field of the @page[1] with PG_head
e7d324850bfcb3 Muchun Song 2022-03-22 223 * because the @page is a compound page composed with at least
e7d324850bfcb3 Muchun Song 2022-03-22 224 * two contiguous pages.
e7d324850bfcb3 Muchun Song 2022-03-22 225 */
e7d324850bfcb3 Muchun Song 2022-03-22 226 unsigned long head = READ_ONCE(page[1].compound_head);
e7d324850bfcb3 Muchun Song 2022-03-22 227
e7d324850bfcb3 Muchun Song 2022-03-22 228 if (likely(head & 1))
e7d324850bfcb3 Muchun Song 2022-03-22 229 return (const struct page *)(head - 1);
e7d324850bfcb3 Muchun Song 2022-03-22 230 }
e7d324850bfcb3 Muchun Song 2022-03-22 231 return page;
e7d324850bfcb3 Muchun Song 2022-03-22 232 }
e7d324850bfcb3 Muchun Song 2022-03-22 233 #else
e7d324850bfcb3 Muchun Song 2022-03-22 234 static inline const struct page *page_fixed_fake_head(const struct page *page)
e7d324850bfcb3 Muchun Song 2022-03-22 235 {
e7d324850bfcb3 Muchun Song 2022-03-22 236 return page;
e7d324850bfcb3 Muchun Song 2022-03-22 237 }
e7d324850bfcb3 Muchun Song 2022-03-22 238 #endif
e7d324850bfcb3 Muchun Song 2022-03-22 239

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki