Re: [PATCH v5] mm: Proactive compaction

From: Holger HoffstÃtte
Date: Thu May 28 2020 - 05:22:50 EST



On 5/18/20 8:14 PM, Nitin Gupta wrote:
[patch v5 :)]

I've been successfully using this in my tree and it works great, but a friend
who also uses my tree just found a bug (actually an improvement ;) due to the
change from HUGETLB_PAGE_ORDER to HPAGE_PMD_ORDER in v5.

When building with CONFIG_TRANSPARENT_HUGEPAGE=n (for some reason it was off)
HPAGE_PMD_SHIFT expands to BUILD_BUG() and compilation fails like this:

...
./include/linux/huge_mm.h:284:28: note: in expansion of macro âBUILD_BUGâ
284 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
| ^~~~~~~~~
./include/linux/huge_mm.h:78:26: note: in expansion of macro âHPAGE_PMD_SHIFTâ
78 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
| ^~~~~~~~~~~~~~~
mm/compaction.c:1874:28: note: in expansion of macro âHPAGE_PMD_ORDERâ
1874 | extfrag_for_order(zone, HPAGE_PMD_ORDER);
| ^~~~~~~~~~~~~~~
...

It would be great if the whole thing would compile without THP; the only
occurrence is in fragmentation_score_zone(). Unfortunately I'm not familiar
enough with how to properly check for THP and properly calculate whatever
you're doing there, otherwise I would ifdef this away myself. ;)

Thanks for an otherwise great patch!

cheers,
Holger