diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2022-10-24 13:01:50 +1000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-12-02 18:04:25 +1100 |
commit | 6b34a099faa123488b13caf704562f4dbe483fc4 (patch) | |
tree | 288c5677f61f2573aa3b768502ce5577b353d4cb /arch/powerpc/mm/book3s64/hash_4k.c | |
parent | dfecd06bc5524517ed7737c30eaaf747338b280a (diff) |
powerpc/64s/hash: add stress_hpt kernel boot option to increase hash faults
This option increases the number of hash misses by limiting the number
of kernel HPT entries, by keeping a per-CPU record of the last kernel
HPTEs installed, and removing that from the hash table on the next hash
insertion. A timer round-robins CPUs removing remaining kernel HPTEs and
clearing the TLB (in the case of bare metal) to increase and slightly
randomise kernel fault activity.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Add comment about NR_CPUS usage, fixup whitespace]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221024030150.852517-1-npiggin@gmail.com
Diffstat (limited to 'arch/powerpc/mm/book3s64/hash_4k.c')
-rw-r--r-- | arch/powerpc/mm/book3s64/hash_4k.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/mm/book3s64/hash_4k.c b/arch/powerpc/mm/book3s64/hash_4k.c index 7de1a8a0c62a..02acbfd05b46 100644 --- a/arch/powerpc/mm/book3s64/hash_4k.c +++ b/arch/powerpc/mm/book3s64/hash_4k.c @@ -16,6 +16,8 @@ #include <asm/machdep.h> #include <asm/mmu.h> +#include "internal.h" + int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, pte_t *ptep, unsigned long trap, unsigned long flags, int ssize, int subpg_prot) @@ -118,6 +120,9 @@ repeat: } new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | H_PAGE_HASHPTE; new_pte |= pte_set_hidx(ptep, rpte, 0, slot, PTRS_PER_PTE); + + if (stress_hpt()) + hpt_do_stress(ea, hpte_group); } *ptep = __pte(new_pte & ~H_PAGE_BUSY); return 0; |