powerpc/mm/radix: Update pte fragment count from 16 to 256 on radix

With split PTL (page table lock) config, we allocate the level
4 (leaf) page table using pte fragment framework instead of slab cache
like other levels. This was done to enable us to have split page table
lock at the level 4 of the page table. We use page->plt backing the
all the level 4 pte fragment for the lock.

Currently with Radix, we use only 16 fragments out of the allocated
page. In radix each fragment is 256 bytes which means we use only 4k
out of the allocated 64K page wasting 60k of the allocated memory.
This was done earlier to keep it closer to hash.

This patch update the pte fragment count to 256, thereby using the
full 64K page and reducing the memory usage. Performance tests shows
really low impact even with THP disabled. With THP disabled we will be
contenting further less on level 4 ptl and hence the impact should be
further low.

  256 threads:
    without patch (10 runs of ./ebizzy  -m -n 1000 -s 131072 -S 100)
      median = 15678.5
      stdev = 42.1209

    with patch:
      median = 15354
      stdev = 194.743

This is with THP disabled. With THP enabled the impact of the patch
will be less.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Aneesh Kumar K.V 2018-03-22 14:13:50 +05:30 committed by Michael Ellerman
parent f2ed480fa4
commit fb4e5dbd44
4 changed files with 17 additions and 12 deletions

View File

@ -37,16 +37,14 @@
/* PTE flags to conserve for HPTE identification */ /* PTE flags to conserve for HPTE identification */
#define _PAGE_HPTEFLAGS (H_PAGE_BUSY | H_PAGE_HASHPTE | H_PAGE_COMBO) #define _PAGE_HPTEFLAGS (H_PAGE_BUSY | H_PAGE_HASHPTE | H_PAGE_COMBO)
/*
* we support 16 fragments per PTE page of 64K size.
*/
#define H_PTE_FRAG_NR 16
/* /*
* We use a 2K PTE page fragment and another 2K for storing * We use a 2K PTE page fragment and another 2K for storing
* real_pte_t hash index * real_pte_t hash index
* 8 bytes per each pte entry and another 8 bytes for storing
* slot details.
*/ */
#define H_PTE_FRAG_SIZE_SHIFT 12 #define H_PTE_FRAG_SIZE_SHIFT (H_PTE_INDEX_SIZE + 3 + 1)
#define PTE_FRAG_SIZE (1UL << PTE_FRAG_SIZE_SHIFT) #define H_PTE_FRAG_NR (PAGE_SIZE >> H_PTE_FRAG_SIZE_SHIFT)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <asm/errno.h> #include <asm/errno.h>

View File

@ -9,5 +9,10 @@
#define RADIX_PMD_INDEX_SIZE 9 /* 1G huge page */ #define RADIX_PMD_INDEX_SIZE 9 /* 1G huge page */
#define RADIX_PUD_INDEX_SIZE 9 #define RADIX_PUD_INDEX_SIZE 9
#define RADIX_PGD_INDEX_SIZE 13 #define RADIX_PGD_INDEX_SIZE 13
/*
* One fragment per per page
*/
#define RADIX_PTE_FRAG_SIZE_SHIFT (RADIX_PTE_INDEX_SIZE + 3)
#define RADIX_PTE_FRAG_NR (PAGE_SIZE >> RADIX_PTE_FRAG_SIZE_SHIFT)
#endif /* _ASM_POWERPC_PGTABLE_RADIX_4K_H */ #endif /* _ASM_POWERPC_PGTABLE_RADIX_4K_H */

View File

@ -10,4 +10,10 @@
#define RADIX_PUD_INDEX_SIZE 9 #define RADIX_PUD_INDEX_SIZE 9
#define RADIX_PGD_INDEX_SIZE 13 #define RADIX_PGD_INDEX_SIZE 13
/*
* We use a 256 byte PTE page fragment in radix
* 8 bytes per each PTE entry.
*/
#define RADIX_PTE_FRAG_SIZE_SHIFT (RADIX_PTE_INDEX_SIZE + 3)
#define RADIX_PTE_FRAG_NR (PAGE_SIZE >> RADIX_PTE_FRAG_SIZE_SHIFT)
#endif /* _ASM_POWERPC_PGTABLE_RADIX_64K_H */ #endif /* _ASM_POWERPC_PGTABLE_RADIX_64K_H */

View File

@ -638,12 +638,8 @@ void __init radix__early_init_mmu(void)
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
pci_io_base = ISA_IO_BASE; pci_io_base = ISA_IO_BASE;
#endif #endif
__pte_frag_nr = RADIX_PTE_FRAG_NR;
/* __pte_frag_size_shift = RADIX_PTE_FRAG_SIZE_SHIFT;
* For now radix also use the same frag size
*/
__pte_frag_nr = H_PTE_FRAG_NR;
__pte_frag_size_shift = H_PTE_FRAG_SIZE_SHIFT;
if (!firmware_has_feature(FW_FEATURE_LPAR)) { if (!firmware_has_feature(FW_FEATURE_LPAR)) {
radix_init_native(); radix_init_native();