On 6/15/20 7:25 AM, Oleksandr Natalenko wrote: > On Mon, Jun 15, 2020 at 10:29:01AM +0200, Oleksandr Natalenko wrote: >> Just to let you know, this fails to compile for me with THP disabled on >> v5.8-rc1: >> >> CC mm/compaction.o >> In file included from ./include/linux/dev_printk.h:14, >> from ./include/linux/device.h:15, >> from ./include/linux/node.h:18, >> from ./include/linux/cpu.h:17, >> from mm/compaction.c:11: >> In function ‘fragmentation_score_zone’, >> inlined from ‘__compact_finished’ at mm/compaction.c:1982:11, >> inlined from ‘compact_zone’ at mm/compaction.c:2062:8: >> ./include/linux/compiler.h:392:38: error: call to ‘__compiletime_assert_397’ >> declared with attribute error: BUILD_BUG failed >> 392 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^ >> ./include/linux/compiler.h:373:4: note: in definition of macro >> ‘__compiletime_assert’ >> 373 | prefix ## suffix(); \ >> | ^~~~~~ >> ./include/linux/compiler.h:392:2: note: in expansion of macro >> ‘_compiletime_assert’ >> 392 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^~~~~~~~~~~~~~~~~~~ >> ./include/linux/build_bug.h:39:37: note: in expansion of macro >> ‘compiletime_assert’ >> 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) >> | ^~~~~~~~~~~~~~~~~~ >> ./include/linux/build_bug.h:59:21: note: in expansion of macro >> ‘BUILD_BUG_ON_MSG’ >> 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") >> | ^~~~~~~~~~~~~~~~ >> ./include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’ >> 319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) >> | ^~~~~~~~~ >> ./include/linux/huge_mm.h:115:26: note: in expansion of macro >> ‘HPAGE_PMD_SHIFT’ >> 115 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) >> | ^~~~~~~~~~~~~~~ >> mm/compaction.c:64:32: note: in expansion of macro ‘HPAGE_PMD_ORDER’ >> 64 | #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER >> | ^~~~~~~~~~~~~~~ >> mm/compaction.c:1898:28: note: in expansion of macro ‘COMPACTION_HPAGE_ORDER’ >> 1898 | extfrag_for_order(zone, COMPACTION_HPAGE_ORDER); >> | ^~~~~~~~~~~~~~~~~~~~~~ >> In function ‘fragmentation_score_zone’, >> inlined from ‘kcompactd’ at mm/compaction.c:1918:12: >> ./include/linux/compiler.h:392:38: error: call to ‘__compiletime_assert_397’ >> declared with attribute error: BUILD_BUG failed >> 392 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^ >> ./include/linux/compiler.h:373:4: note: in definition of macro >> ‘__compiletime_assert’ >> 373 | prefix ## suffix(); \ >> | ^~~~~~ >> ./include/linux/compiler.h:392:2: note: in expansion of macro >> ‘_compiletime_assert’ >> 392 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^~~~~~~~~~~~~~~~~~~ >> ./include/linux/build_bug.h:39:37: note: in expansion of macro >> ‘compiletime_assert’ >> 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) >> | ^~~~~~~~~~~~~~~~~~ >> ./include/linux/build_bug.h:59:21: note: in expansion of macro >> ‘BUILD_BUG_ON_MSG’ >> 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") >> | ^~~~~~~~~~~~~~~~ >> ./include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’ >> 319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) >> | ^~~~~~~~~ >> ./include/linux/huge_mm.h:115:26: note: in expansion of macro >> ‘HPAGE_PMD_SHIFT’ >> 115 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) >> | ^~~~~~~~~~~~~~~ >> mm/compaction.c:64:32: note: in expansion of macro ‘HPAGE_PMD_ORDER’ >> 64 | #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER >> | ^~~~~~~~~~~~~~~ >> mm/compaction.c:1898:28: note: in expansion of macro ‘COMPACTION_HPAGE_ORDER’ >> 1898 | extfrag_for_order(zone, COMPACTION_HPAGE_ORDER); >> | ^~~~~~~~~~~~~~~~~~~~~~ >> In function ‘fragmentation_score_zone’, >> inlined from ‘kcompactd’ at mm/compaction.c:1918:12: >> ./include/linux/compiler.h:392:38: error: call to ‘__compiletime_assert_397’ >> declared with attribute error: BUILD_BUG failed >> 392 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^ >> ./include/linux/compiler.h:373:4: note: in definition of macro >> ‘__compiletime_assert’ >> 373 | prefix ## suffix(); \ >> | ^~~~~~ >> ./include/linux/compiler.h:392:2: note: in expansion of macro >> ‘_compiletime_assert’ >> 392 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^~~~~~~~~~~~~~~~~~~ >> ./include/linux/build_bug.h:39:37: note: in expansion of macro >> ‘compiletime_assert’ >> 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) >> | ^~~~~~~~~~~~~~~~~~ >> ./include/linux/build_bug.h:59:21: note: in expansion of macro >> ‘BUILD_BUG_ON_MSG’ >> 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") >> | ^~~~~~~~~~~~~~~~ >> ./include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’ >> 319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) >> | ^~~~~~~~~ >> ./include/linux/huge_mm.h:115:26: note: in expansion of macro >> ‘HPAGE_PMD_SHIFT’ >> 115 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) >> | ^~~~~~~~~~~~~~~ >> mm/compaction.c:64:32: note: in expansion of macro ‘HPAGE_PMD_ORDER’ >> 64 | #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER >> | ^~~~~~~~~~~~~~~ >> mm/compaction.c:1898:28: note: in expansion of macro ‘COMPACTION_HPAGE_ORDER’ >> 1898 | extfrag_for_order(zone, COMPACTION_HPAGE_ORDER); >> | ^~~~~~~~~~~~~~~~~~~~~~ >> In function ‘fragmentation_score_zone’, >> inlined from ‘kcompactd’ at mm/compaction.c:1918:12: >> ./include/linux/compiler.h:392:38: error: call to ‘__compiletime_assert_397’ >> declared with attribute error: BUILD_BUG failed >> 392 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^ >> ./include/linux/compiler.h:373:4: note: in definition of macro >> ‘__compiletime_assert’ >> 373 | prefix ## suffix(); \ >> | ^~~~~~ >> ./include/linux/compiler.h:392:2: note: in expansion of macro >> ‘_compiletime_assert’ >> 392 | _compiletime_assert(condition, msg, __compiletime_assert_, >> __COUNTER__) >> | ^~~~~~~~~~~~~~~~~~~ >> ./include/linux/build_bug.h:39:37: note: in expansion of macro >> ‘compiletime_assert’ >> 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) >> | ^~~~~~~~~~~~~~~~~~ >> ./include/linux/build_bug.h:59:21: note: in expansion of macro >> ‘BUILD_BUG_ON_MSG’ >> 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") >> | ^~~~~~~~~~~~~~~~ >> ./include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’ >> 319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) >> | ^~~~~~~~~ >> ./include/linux/huge_mm.h:115:26: note: in expansion of macro >> ‘HPAGE_PMD_SHIFT’ >> 115 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) >> | ^~~~~~~~~~~~~~~ >> mm/compaction.c:64:32: note: in expansion of macro ‘HPAGE_PMD_ORDER’ >> 64 | #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER >> | ^~~~~~~~~~~~~~~ >> mm/compaction.c:1898:28: note: in expansion of macro ‘COMPACTION_HPAGE_ORDER’ >> 1898 | extfrag_for_order(zone, COMPACTION_HPAGE_ORDER); >> | ^~~~~~~~~~~~~~~~~~~~~~ >> make[1]: *** [scripts/Makefile.build:281: mm/compaction.o] Error 1 >> make: *** [Makefile:1764: mm] Error 2 >> > > What about doing this: > > diff --git a/mm/compaction.c b/mm/compaction.c > index 0d4f91dfb801..ac2030814edb 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -60,7 +60,7 @@ static const int HPAGE_FRAG_CHECK_INTERVAL_MSEC = 500; > * calculates external fragmentation, which is used as > * the "fragmentation score" of a node/zone. > */ > -#if defined HPAGE_PMD_ORDER > +#if defined CONFIG_TRANSPARENT_HUGEPAGE > #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER > #elif defined HUGETLB_PAGE_ORDER > #define COMPACTION_HPAGE_ORDER HUGETLB_PAGE_ORDER > > ? >
Yes, this looks good. I will send out a v7 patch soon with this change. Thanks, Nitin