]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
thp, s390: thp pagetable pre-allocation for s390
authorGerald Schaefer <gerald.schaefer@de.ibm.com>
Mon, 8 Oct 2012 23:30:18 +0000 (16:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Oct 2012 07:22:30 +0000 (16:22 +0900)
This patch is part of the architecture backend for thp on s390.  It
provides the pagetable pre-allocation functions
pgtable_trans_huge_deposit() and pgtable_trans_huge_withdraw().  Unlike
other archs, s390 has no struct page * as pgtable_t, but rather a pointer
to the page table.  So instead of saving the pagetable pre- allocation
list info inside the struct page, it is being saved within the pagetable
itself.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Hillf Danton <dhillf@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/s390/include/asm/pgtable.h
arch/s390/mm/pgtable.c

index c3f0775e71f1d3dead5be36d193ce99dc9c9a0e4..2c8f00d31cfe27476d4e2ba1d3ac20b6db43bf95 100644 (file)
@@ -1166,6 +1166,12 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
 #define pte_unmap(pte) do { } while (0)
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+#define __HAVE_ARCH_PGTABLE_DEPOSIT
+extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
+
+#define __HAVE_ARCH_PGTABLE_WITHDRAW
+extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm);
+
 static inline int pmd_trans_splitting(pmd_t pmd)
 {
        return pmd_val(pmd) & _SEGMENT_ENTRY_SPLIT;
index a6131d1fe6c0622b6ee443d4a7f0e255b2baae42..1ca371a06516e185e44cfd5590d98632db57feb9 100644 (file)
@@ -883,4 +883,42 @@ void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
                smp_call_function(pmdp_splitting_flush_sync, NULL, 1);
        }
 }
+
+void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable)
+{
+       struct list_head *lh = (struct list_head *) pgtable;
+
+       assert_spin_locked(&mm->page_table_lock);
+
+       /* FIFO */
+       if (!mm->pmd_huge_pte)
+               INIT_LIST_HEAD(lh);
+       else
+               list_add(lh, (struct list_head *) mm->pmd_huge_pte);
+       mm->pmd_huge_pte = pgtable;
+}
+
+pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm)
+{
+       struct list_head *lh;
+       pgtable_t pgtable;
+       pte_t *ptep;
+
+       assert_spin_locked(&mm->page_table_lock);
+
+       /* FIFO */
+       pgtable = mm->pmd_huge_pte;
+       lh = (struct list_head *) pgtable;
+       if (list_empty(lh))
+               mm->pmd_huge_pte = NULL;
+       else {
+               mm->pmd_huge_pte = (pgtable_t) lh->next;
+               list_del(lh);
+       }
+       ptep = (pte_t *) pgtable;
+       pte_val(*ptep) = _PAGE_TYPE_EMPTY;
+       ptep++;
+       pte_val(*ptep) = _PAGE_TYPE_EMPTY;
+       return pgtable;
+}
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */