aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hugetlb.h
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2013-11-14 17:31:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-14 19:32:14 -0500
commitcb900f41215447433cbc456d1c4294e858a84d7c (patch)
tree1f3704d9a023a20baa2872d6639a58387ef2d7c2 /include/linux/hugetlb.h
parentc389a250ab4cfa4a3775d9f2c45271618af6d5b2 (diff)
mm, hugetlb: convert hugetlbfs to use split pmd lock
Hugetlb supports multiple page sizes. We use split lock only for PMD level, but not for PUD. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Tested-by: Alex Thorlton <athorlton@sgi.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: "Eric W . Biederman" <ebiederm@xmission.com> Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Dave Jones <davej@redhat.com> Cc: David Howells <dhowells@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Kees Cook <keescook@chromium.org> Cc: Mel Gorman <mgorman@suse.de> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@redhat.com> Cc: Robin Holt <robinmholt@gmail.com> Cc: Sedat Dilek <sedat.dilek@gmail.com> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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 */