diff options
Diffstat (limited to 'include/linux/huge_mm.h')
-rw-r--r-- | include/linux/huge_mm.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 1b921299abc4..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 |
@@ -113,6 +114,18 @@ extern void __vma_adjust_trans_huge(struct vm_area_struct *vma, | |||
113 | unsigned long start, | 114 | unsigned long start, |
114 | unsigned long end, | 115 | unsigned long end, |
115 | long adjust_next); | 116 | long adjust_next); |
117 | extern int __pmd_trans_huge_lock(pmd_t *pmd, | ||
118 | struct vm_area_struct *vma); | ||
119 | /* mmap_sem must be held on entry */ | ||
120 | static inline int pmd_trans_huge_lock(pmd_t *pmd, | ||
121 | struct vm_area_struct *vma) | ||
122 | { | ||
123 | VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); | ||
124 | if (pmd_trans_huge(*pmd)) | ||
125 | return __pmd_trans_huge_lock(pmd, vma); | ||
126 | else | ||
127 | return 0; | ||
128 | } | ||
116 | static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, | 129 | static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, |
117 | unsigned long start, | 130 | unsigned long start, |
118 | unsigned long end, | 131 | unsigned long end, |
@@ -146,9 +159,9 @@ static inline struct page *compound_trans_head(struct page *page) | |||
146 | return page; | 159 | return page; |
147 | } | 160 | } |
148 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ | 161 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ |
149 | #define HPAGE_PMD_SHIFT ({ BUG(); 0; }) | 162 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) |
150 | #define HPAGE_PMD_MASK ({ BUG(); 0; }) | 163 | #define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; }) |
151 | #define HPAGE_PMD_SIZE ({ BUG(); 0; }) | 164 | #define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; }) |
152 | 165 | ||
153 | #define hpage_nr_pages(x) 1 | 166 | #define hpage_nr_pages(x) 1 |
154 | 167 | ||
@@ -176,6 +189,11 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, | |||
176 | long adjust_next) | 189 | long adjust_next) |
177 | { | 190 | { |
178 | } | 191 | } |
192 | static inline int pmd_trans_huge_lock(pmd_t *pmd, | ||
193 | struct vm_area_struct *vma) | ||
194 | { | ||
195 | return 0; | ||
196 | } | ||
179 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 197 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
180 | 198 | ||
181 | #endif /* _LINUX_HUGE_MM_H */ | 199 | #endif /* _LINUX_HUGE_MM_H */ |