s390/mm: enable split page table lock for PMD level
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 12 Feb 2014 13:16:18 +0000 (14:16 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 21 Feb 2014 07:50:22 +0000 (08:50 +0100)
Add the pgtable_pmd_page_ctor/pgtable_pmd_page_dtor calls to the pmd
allocation and free functions and enable ARCH_ENABLE_SPLIT_PMD_PTLOCK
for 64 bit.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/Kconfig
arch/s390/include/asm/pgalloc.h
arch/s390/mm/pgtable.c

index 65a07750f4f946f038bb2e2a4e13f9f6d05dce83..86db5a8e6586b4940ed375c7f34715dffd96511c 100644 (file)
@@ -415,6 +415,10 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
 config ARCH_ENABLE_MEMORY_HOTREMOVE
        def_bool y
 
+config ARCH_ENABLE_SPLIT_PMD_PTLOCK
+       def_bool y
+       depends on 64BIT
+
 config FORCE_MAX_ZONEORDER
        int
        default "9"
index 14d43c77d6cf9cea678d56dff8076b78346934c4..884017cbfa9fade412372f7f781e503b3f39513b 100644 (file)
@@ -92,11 +92,22 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
 {
        unsigned long *table = crst_table_alloc(mm);
-       if (table)
-               crst_table_init(table, _SEGMENT_ENTRY_EMPTY);
+
+       if (!table)
+               return NULL;
+       crst_table_init(table, _SEGMENT_ENTRY_EMPTY);
+       if (!pgtable_pmd_page_ctor(virt_to_page(table))) {
+               crst_table_free(mm, table);
+               return NULL;
+       }
        return (pmd_t *) table;
 }
-#define pmd_free(mm, pmd) crst_table_free(mm, (unsigned long *) pmd)
+
+static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
+{
+       pgtable_pmd_page_dtor(virt_to_page(pmd));
+       crst_table_free(mm, (unsigned long *) pmd);
+}
 
 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
 {
index 9c26b7aa96d97831b0190a1ea63216430bad1f18..f8b58a7a3048112798c8314102b1940eec4a8bbe 100644 (file)
@@ -1397,7 +1397,7 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
 {
        struct list_head *lh = (struct list_head *) pgtable;
 
-       assert_spin_locked(&mm->page_table_lock);
+       assert_spin_locked(pmd_lockptr(mm, pmdp));
 
        /* FIFO */
        if (!pmd_huge_pte(mm, pmdp))
@@ -1413,7 +1413,7 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
        pgtable_t pgtable;
        pte_t *ptep;
 
-       assert_spin_locked(&mm->page_table_lock);
+       assert_spin_locked(pmd_lockptr(mm, pmdp));
 
        /* FIFO */
        pgtable = pmd_huge_pte(mm, pmdp);