OSDN Git Service

powerpc/mm: Avoid useless lock with single page fragments
authorChristophe Leroy <christophe.leroy@c-s.fr>
Thu, 29 Nov 2018 14:06:53 +0000 (14:06 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 Dec 2018 08:45:01 +0000 (19:45 +1100)
There is no point in taking the page table lock as pte_frag or
pmd_frag are always NULL when we have only one fragment.

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/pgtable-book3s64.c
arch/powerpc/mm/pgtable-frag.c

index 0c0fd17..f3c31f5 100644 (file)
@@ -244,6 +244,9 @@ static pmd_t *get_pmd_from_cache(struct mm_struct *mm)
 {
        void *pmd_frag, *ret;
 
+       if (PMD_FRAG_NR == 1)
+               return NULL;
+
        spin_lock(&mm->page_table_lock);
        ret = mm->context.pmd_frag;
        if (ret) {
index d61e7c2..7544d0d 100644 (file)
@@ -34,6 +34,9 @@ static pte_t *get_pte_from_cache(struct mm_struct *mm)
 {
        void *pte_frag, *ret;
 
+       if (PTE_FRAG_NR == 1)
+               return NULL;
+
        spin_lock(&mm->page_table_lock);
        ret = mm->context.pte_frag;
        if (ret) {