aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hugetlb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r--include/linux/hugetlb.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 0393270466c3..acd2010328f3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -392,6 +392,15 @@ static inline int hugepage_migration_support(struct hstate *h)
392 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT); 392 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT);
393} 393}
394 394
395static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
396 struct mm_struct *mm, pte_t *pte)
397{
398 if (huge_page_size(h) == PMD_SIZE)
399 return pmd_lockptr(mm, (pmd_t *) pte);
400 VM_BUG_ON(huge_page_size(h) == PAGE_SIZE);
401 return &mm->page_table_lock;
402}
403
395#else /* CONFIG_HUGETLB_PAGE */ 404#else /* CONFIG_HUGETLB_PAGE */
396struct hstate {}; 405struct hstate {};
397#define alloc_huge_page_node(h, nid) NULL 406#define alloc_huge_page_node(h, nid) NULL
@@ -401,6 +410,7 @@ struct hstate {};
401#define hstate_sizelog(s) NULL 410#define hstate_sizelog(s) NULL
402#define hstate_vma(v) NULL 411#define hstate_vma(v) NULL
403#define hstate_inode(i) NULL 412#define hstate_inode(i) NULL
413#define page_hstate(page) NULL
404#define huge_page_size(h) PAGE_SIZE 414#define huge_page_size(h) PAGE_SIZE
405#define huge_page_mask(h) PAGE_MASK 415#define huge_page_mask(h) PAGE_MASK
406#define vma_kernel_pagesize(v) PAGE_SIZE 416#define vma_kernel_pagesize(v) PAGE_SIZE
@@ -421,6 +431,22 @@ static inline pgoff_t basepage_index(struct page *page)
421#define dissolve_free_huge_pages(s, e) do {} while (0) 431#define dissolve_free_huge_pages(s, e) do {} while (0)
422#define pmd_huge_support() 0 432#define pmd_huge_support() 0
423#define hugepage_migration_support(h) 0 433#define hugepage_migration_support(h) 0
434
435static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
436 struct mm_struct *mm, pte_t *pte)
437{
438 return &mm->page_table_lock;
439}
424#endif /* CONFIG_HUGETLB_PAGE */ 440#endif /* CONFIG_HUGETLB_PAGE */
425 441
442static inline spinlock_t *huge_pte_lock(struct hstate *h,
443 struct mm_struct *mm, pte_t *pte)
444{
445 spinlock_t *ptl;
446
447 ptl = huge_pte_lockptr(h, mm, pte);
448 spin_lock(ptl);
449 return ptl;
450}
451
426#endif /* _LINUX_HUGETLB_H */ 452#endif /* _LINUX_HUGETLB_H */