mm, powerpc, x86: introduce an additional vma bit for powerpc pkey
authorRam Pai <linuxram@us.ibm.com>
Tue, 27 Mar 2018 09:09:27 +0000 (02:09 -0700)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 9 May 2018 01:50:27 +0000 (11:50 +1000)
Currently only 4bits are allocated in the vma flags to hold 16
keys. This is sufficient for x86. PowerPC  supports  32  keys,
which needs 5bits. This patch allocates an  additional bit.

Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
[mpe: Fold in #if VM_PKEY_BIT4 as noticed by Dave Hansen]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
fs/proc/task_mmu.c
include/linux/mm.h

index 541392a62608987954f106ecefd05f4186182516..c2163606e6fba075f691a44075036ca6895520d6 100644 (file)
@@ -679,6 +679,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
                [ilog2(VM_PKEY_BIT1)]   = "",
                [ilog2(VM_PKEY_BIT2)]   = "",
                [ilog2(VM_PKEY_BIT3)]   = "",
+#if VM_PKEY_BIT4
+               [ilog2(VM_PKEY_BIT4)]   = "",
+#endif
 #endif /* CONFIG_ARCH_HAS_PKEYS */
        };
        size_t i;
index c6a6f2492c1b3fb17fe9d8882001885b02c8480d..fc25929031c0d48ac6e6d0e36e87ce3e3ced7bbb 100644 (file)
@@ -231,9 +231,14 @@ extern unsigned int kobjsize(const void *objp);
 #ifdef CONFIG_ARCH_HAS_PKEYS
 # define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0
 # define VM_PKEY_BIT0  VM_HIGH_ARCH_0  /* A protection key is a 4-bit value */
-# define VM_PKEY_BIT1  VM_HIGH_ARCH_1
+# define VM_PKEY_BIT1  VM_HIGH_ARCH_1  /* on x86 and 5-bit value on ppc64   */
 # define VM_PKEY_BIT2  VM_HIGH_ARCH_2
 # define VM_PKEY_BIT3  VM_HIGH_ARCH_3
+#ifdef CONFIG_PPC
+# define VM_PKEY_BIT4  VM_HIGH_ARCH_4
+#else
+# define VM_PKEY_BIT4  0
+#endif
 #endif /* CONFIG_ARCH_HAS_PKEYS */
 
 #if defined(CONFIG_X86)