Commit 9491846fca57e9326b6673716c386b76fc13ebca

Authored by Kirill A. Shutemov
Committed by Linus Torvalds
1 parent e009bb30c8

x86, mm: enable split page table lock for PMD level

Enable PMD split page table lock for X86_64 and PAE.

[akpm@linux-foundation.org: coding-style fixes]
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: Naoya Horiguchi <n-horiguchi@ah.jp.nec.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>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 14 additions and 1 deletions Side-by-side Diff

... ... @@ -1885,6 +1885,10 @@
1885 1885 def_bool y
1886 1886 depends on NUMA
1887 1887  
  1888 +config ARCH_ENABLE_SPLIT_PMD_PTLOCK
  1889 + def_bool y
  1890 + depends on X86_64 || X86_PAE
  1891 +
1888 1892 menu "Power management and ACPI options"
1889 1893  
1890 1894 config ARCH_HIBERNATION_HEADER
arch/x86/include/asm/pgalloc.h
... ... @@ -80,12 +80,21 @@
80 80 #if PAGETABLE_LEVELS > 2
81 81 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
82 82 {
83   - return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
  83 + struct page *page;
  84 + page = alloc_pages(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO, 0);
  85 + if (!page)
  86 + return NULL;
  87 + if (!pgtable_pmd_page_ctor(page)) {
  88 + __free_pages(page, 0);
  89 + return NULL;
  90 + }
  91 + return (pmd_t *)page_address(page);
84 92 }
85 93  
86 94 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
87 95 {
88 96 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
  97 + pgtable_pmd_page_dtor(virt_to_page(pmd));
89 98 free_page((unsigned long)pmd);
90 99 }
91 100