OSDN Git Service

powerpc/mm/hash: Store addr_limit in PACA
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Wed, 22 Mar 2017 03:36:59 +0000 (09:06 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 1 Apr 2017 10:12:27 +0000 (21:12 +1100)
We optmize the slice page size array copy to paca by copying only the
range based on addr_limit. This will require us to not look at page size
array beyond addr_limit in PACA on slb fault. To enable that copy task
size to paca which will be used during slb fault.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[mpe: Rename from task_size to addr_limit, consolidate #ifdefs]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/paca.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/paca.c
arch/powerpc/mm/slb_low.S

index f48c250..65d0ffb 100644 (file)
@@ -139,6 +139,7 @@ struct paca_struct {
 #ifdef CONFIG_PPC_MM_SLICES
        u64 mm_ctx_low_slices_psize;
        unsigned char mm_ctx_high_slices_psize[SLICE_ARRAY_SIZE];
+       unsigned long addr_limit;
 #else
        u16 mm_ctx_user_psize;
        u16 mm_ctx_sllp;
index 4367e7d..795505e 100644 (file)
@@ -185,6 +185,7 @@ int main(void)
 #ifdef CONFIG_PPC_MM_SLICES
        OFFSET(PACALOWSLICESPSIZE, paca_struct, mm_ctx_low_slices_psize);
        OFFSET(PACAHIGHSLICEPSIZE, paca_struct, mm_ctx_high_slices_psize);
+       DEFINE(PACA_ADDR_LIMIT, offsetof(struct paca_struct, addr_limit));
        DEFINE(MMUPSIZEDEFSIZE, sizeof(struct mmu_psize_def));
 #endif /* CONFIG_PPC_MM_SLICES */
 #endif
index a2c7a64..8d63627 100644 (file)
@@ -254,6 +254,7 @@ void copy_mm_to_paca(struct mm_struct *mm)
        get_paca()->mm_ctx_id = context->id;
 #ifdef CONFIG_PPC_MM_SLICES
        VM_BUG_ON(!mm->context.addr_limit);
+       get_paca()->addr_limit = mm->context.addr_limit;
        get_paca()->mm_ctx_low_slices_psize = context->low_slices_psize;
        memcpy(&get_paca()->mm_ctx_high_slices_psize,
               &context->high_slices_psize, TASK_SLICE_ARRAY_SZ(mm));
index 1c503d0..1519617 100644 (file)
@@ -149,7 +149,13 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
         * For userspace addresses, make sure this is region 0.
         */
        cmpdi   r9, 0
-       bne     8f
+       bne-    8f
+        /*
+         * user space make sure we are within the allowed limit
+        */
+       ld      r11,PACA_ADDR_LIMIT(r13)
+       cmpld   r3,r11
+       bge-    8f
 
        /* when using slices, we extract the psize off the slice bitmaps
         * and then we need to get the sllp encoding off the mmu_psize_defs