From: Kirill A. Shutemov Date: Tue, 25 Jun 2013 21:15:36 +0000 (-0700) Subject: mm/thp: define HPAGE_PMD_* constants as BUILD_BUG() if !THP X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3766a1abc53164f058d74f950599c797cb3fe302;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mm/thp: define HPAGE_PMD_* constants as BUILD_BUG() if !THP Currently, HPAGE_PMD_* constans rely on PMD_SHIFT regardless of CONFIG_TRANSPARENT_HUGEPAGE. PMD_SHIFT is not defined everywhere (e.g. arm nommu case). It means we can't use anything like this in generic code: if (PageTransHuge(page)) zero_huge_user(page, 0, HPAGE_PMD_SIZE); else clear_highpage(page); For !THP case, PageTransHuge() is 0 and compiler can eliminate zero_huge_user() call. But it still need to be valid C expression, means HPAGE_PMD_SIZE has to expand to something compiler can understand. Previously, HPAGE_PMD_* were defined to BUILD_BUG() for !THP. Let's come back to it. Signed-off-by: Kirill A. Shutemov Signed-off-by: Andrew Morton Signed-off-by: Benjamin Herrenschmidt --- diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index cc276d2c3a40..e2dbefb38e3b 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -58,11 +58,12 @@ extern pmd_t *page_check_address_pmd(struct page *page, #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) #define HPAGE_PMD_NR (1<