On Mon, 19 Dec 2011, David Daney wrote:
From: David Daney<david.daney@xxxxxxxxxx>
It has been reported that when building for sh:
mm/pgtable-generic.c: In function 'pmdp_clear_flush_young':
mm/pgtable-generic.c:76: error: call to '__build_bug_failed' declared with attribute error: BUILD_BUG failed
Adding some ugle #ifdeffery will probably fix this issue.
It won't, CONFIG_HUGETLB_PAGE has nothing at all to do with this.
Signed-off-by: David Daney<david.daney@xxxxxxxxxx>
---
This is completely untested, but may be the best fix for this. Linus
and others have expressed a dislike for using BUG() to detect what
should be dead code paths at runtime, but it seems to be the state of
the art here.
The problem here is that HPAGE_PMD_MASK is being referenced without
CONFIG_TRANSPARENT_HUGEPAGE. pmdp_clear_flush_young() is only applicable
with that config option enabled. So rather than trying to minimize lines
captured under an #ifdef by placing the BUG() directly in the function for
asm-generic, you'll need to wrap pmd_clear_flush_young() with
#ifdef CONFIG_TRANSPARENT_HUGEPAGE and define its equivalent for
CONFIG_TRANSPARENT_HUGEPAGE=n that breaks the build if not enabled.
mm/pgtable-generic.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index eb663fb..73784c8 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -70,7 +70,7 @@ int pmdp_clear_flush_young(struct vm_area_struct *vma,
unsigned long address, pmd_t *pmdp)
{
int young;
-#ifndef CONFIG_TRANSPARENT_HUGEPAGE
+#if !defined(CONFIG_HUGETLB_PAGE) || !defined(CONFIG_TRANSPARENT_HUGEPAGE)
BUG();
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
VM_BUG_ON(address& ~HPAGE_PMD_MASK);