aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/huge_mm.h
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2012-03-21 19:34:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 20:55:02 -0400
commitd8c37c480678ebe09bc570f33e085e28049db035 (patch)
treec8c53fde803f1a9655f44193c97db76dc4a90fe1 /include/linux/huge_mm.h
parent8d32ff84401f1addb961c7af2c8d9baceb0ab9ba (diff)
thp: add HPAGE_PMD_* definitions for !CONFIG_TRANSPARENT_HUGEPAGE
These macros will be used in a later patch, where all usages are expected to be optimized away without #ifdef CONFIG_TRANSPARENT_HUGEPAGE. But to detect unexpected usages, we convert the existing BUG() to BUILD_BUG(). [akpm@linux-foundation.org: fix build in mm/pgtable-generic.c] Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Acked-by: Hillf Danton <dhillf@gmail.com> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: David Rientjes <rientjes@google.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/huge_mm.h')
-rw-r--r--include/linux/huge_mm.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index f56cacb4fec3..c8af7a2efb52 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -51,6 +51,9 @@ extern pmd_t *page_check_address_pmd(struct page *page,
51 unsigned long address, 51 unsigned long address,
52 enum page_check_address_pmd_flag flag); 52 enum page_check_address_pmd_flag flag);
53 53
54#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
55#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
56
54#ifdef CONFIG_TRANSPARENT_HUGEPAGE 57#ifdef CONFIG_TRANSPARENT_HUGEPAGE
55#define HPAGE_PMD_SHIFT HPAGE_SHIFT 58#define HPAGE_PMD_SHIFT HPAGE_SHIFT
56#define HPAGE_PMD_MASK HPAGE_MASK 59#define HPAGE_PMD_MASK HPAGE_MASK
@@ -102,8 +105,6 @@ extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd);
102 BUG_ON(pmd_trans_splitting(*____pmd) || \ 105 BUG_ON(pmd_trans_splitting(*____pmd) || \
103 pmd_trans_huge(*____pmd)); \ 106 pmd_trans_huge(*____pmd)); \
104 } while (0) 107 } while (0)
105#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
106#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
107#if HPAGE_PMD_ORDER > MAX_ORDER 108#if HPAGE_PMD_ORDER > MAX_ORDER
108#error "hugepages can't be allocated by the buddy allocator" 109#error "hugepages can't be allocated by the buddy allocator"
109#endif 110#endif
@@ -158,9 +159,9 @@ static inline struct page *compound_trans_head(struct page *page)
158 return page; 159 return page;
159} 160}
160#else /* CONFIG_TRANSPARENT_HUGEPAGE */ 161#else /* CONFIG_TRANSPARENT_HUGEPAGE */
161#define HPAGE_PMD_SHIFT ({ BUG(); 0; }) 162#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
162#define HPAGE_PMD_MASK ({ BUG(); 0; }) 163#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
163#define HPAGE_PMD_SIZE ({ BUG(); 0; }) 164#define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; })
164 165
165#define hpage_nr_pages(x) 1 166#define hpage_nr_pages(x) 1
166 167