powerpc/pmap64: Make moea64 statistics optional
Summary: It turns out statistics accounting is very expensive in the pmap driver, and doesn't seem necessary in the common case. Make this optional behind a MOEA64_STATS #define, which one can set if they really need statistics. This saves ~7-8% on buildworld time on a POWER9. Found by bdragon. Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D20903
This commit is contained in:
parent
160915367c
commit
7c382eea30
@ -19,6 +19,7 @@ GFB_DEBUG opt_gfb.h
|
||||
GFB_NO_FONT_LOADING opt_gfb.h
|
||||
GFB_NO_MODE_CHANGE opt_gfb.h
|
||||
|
||||
MOEA64_STATS opt_pmap.h
|
||||
MPC85XX opt_platform.h
|
||||
POWERMAC opt_platform.h
|
||||
PS3 opt_platform.h
|
||||
|
@ -200,6 +200,7 @@ static u_int moea64_vsid_bitmap[NVSIDS / VSID_NBPW];
|
||||
|
||||
static boolean_t moea64_initialized = FALSE;
|
||||
|
||||
#ifdef MOEA64_STATS
|
||||
/*
|
||||
* Statistics.
|
||||
*/
|
||||
@ -218,6 +219,7 @@ SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_enter_calls, CTLFLAG_RD,
|
||||
&moea64_pvo_enter_calls, 0, "");
|
||||
SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_remove_calls, CTLFLAG_RD,
|
||||
&moea64_pvo_remove_calls, 0, "");
|
||||
#endif
|
||||
|
||||
vm_offset_t moea64_scratchpage_va[2];
|
||||
struct pvo_entry *moea64_scratchpage_pvo[2];
|
||||
@ -1434,7 +1436,7 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, vm_page_t m,
|
||||
|
||||
/* If not in page table, reinsert it */
|
||||
if (MOEA64_PTE_SYNCH(mmu, oldpvo) < 0) {
|
||||
moea64_pte_overflow--;
|
||||
STAT_MOEA64(moea64_pte_overflow--);
|
||||
MOEA64_PTE_INSERT(mmu, oldpvo);
|
||||
}
|
||||
|
||||
@ -2522,7 +2524,7 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, struct pvo_head *pvo_head,
|
||||
|
||||
PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED);
|
||||
|
||||
moea64_pvo_enter_calls++;
|
||||
STAT_MOEA64(moea64_pvo_enter_calls++);
|
||||
|
||||
/*
|
||||
* Add to pmap list
|
||||
@ -2557,7 +2559,7 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, struct pvo_head *pvo_head,
|
||||
panic("moea64_pvo_enter: overflow");
|
||||
}
|
||||
|
||||
moea64_pvo_entries++;
|
||||
STAT_MOEA64(moea64_pvo_entries++);
|
||||
|
||||
if (pvo->pvo_pmap == kernel_pmap)
|
||||
isync();
|
||||
@ -2656,8 +2658,8 @@ moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo,
|
||||
}
|
||||
}
|
||||
|
||||
moea64_pvo_entries--;
|
||||
moea64_pvo_remove_calls++;
|
||||
STAT_MOEA64(moea64_pvo_entries--);
|
||||
STAT_MOEA64(moea64_pvo_remove_calls++);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _POWERPC_AIM_MMU_OEA64_H
|
||||
#define _POWERPC_AIM_MMU_OEA64_H
|
||||
|
||||
#include "opt_pmap.h"
|
||||
|
||||
#include <machine/mmuvar.h>
|
||||
|
||||
extern mmu_def_t oea64_mmu;
|
||||
@ -72,8 +74,13 @@ void moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart,
|
||||
* Statistics
|
||||
*/
|
||||
|
||||
#ifdef MOEA64_STATS
|
||||
extern u_int moea64_pte_valid;
|
||||
extern u_int moea64_pte_overflow;
|
||||
#define STAT_MOEA64(x) x
|
||||
#else
|
||||
#define STAT_MOEA64(x) ((void)0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* State variables
|
||||
|
@ -332,7 +332,7 @@ moea64_pte_unset_native(mmu_t mmu, struct pvo_entry *pvo)
|
||||
if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) !=
|
||||
(properpt.pte_hi & LPTE_AVPN_MASK)) {
|
||||
/* Evicted */
|
||||
moea64_pte_overflow--;
|
||||
STAT_MOEA64(moea64_pte_overflow--);
|
||||
rw_runlock(&moea64_eviction_lock);
|
||||
return (-1);
|
||||
}
|
||||
@ -352,7 +352,7 @@ moea64_pte_unset_native(mmu_t mmu, struct pvo_entry *pvo)
|
||||
rw_runlock(&moea64_eviction_lock);
|
||||
|
||||
/* Keep statistics */
|
||||
moea64_pte_valid--;
|
||||
STAT_MOEA64(moea64_pte_valid--);
|
||||
|
||||
return (ptelo & (LPTE_CHG | LPTE_REF));
|
||||
}
|
||||
@ -656,8 +656,8 @@ moea64_insert_to_pteg_native(struct lpte *pvo_pt, uintptr_t slotbase,
|
||||
(ADDR_API_SHFT64 - ADDR_PIDX_SHFT);
|
||||
PTESYNC();
|
||||
TLBIE(va);
|
||||
moea64_pte_valid--;
|
||||
moea64_pte_overflow++;
|
||||
STAT_MOEA64(moea64_pte_valid--);
|
||||
STAT_MOEA64(moea64_pte_overflow++);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -670,7 +670,7 @@ moea64_insert_to_pteg_native(struct lpte *pvo_pt, uintptr_t slotbase,
|
||||
PTESYNC();
|
||||
|
||||
/* Keep statistics */
|
||||
moea64_pte_valid++;
|
||||
STAT_MOEA64(moea64_pte_valid++);
|
||||
|
||||
return (k);
|
||||
}
|
||||
|
@ -224,14 +224,14 @@ mps3_pte_unset(mmu_t mmu, struct pvo_entry *pvo)
|
||||
mtx_lock(&mps3_table_lock);
|
||||
refchg = mps3_pte_synch_locked(pvo);
|
||||
if (refchg < 0) {
|
||||
moea64_pte_overflow--;
|
||||
STAT_MOEA64(moea64_pte_overflow--);
|
||||
mtx_unlock(&mps3_table_lock);
|
||||
return (-1);
|
||||
}
|
||||
/* XXX: race on RC bits between unset and sync. Anything to do? */
|
||||
lv1_write_htab_entry(mps3_vas_id, pvo->pvo_pte.slot, 0, 0);
|
||||
mtx_unlock(&mps3_table_lock);
|
||||
moea64_pte_valid--;
|
||||
STAT_MOEA64(moea64_pte_valid--);
|
||||
|
||||
return (refchg & (LPTE_REF | LPTE_CHG));
|
||||
}
|
||||
@ -272,13 +272,13 @@ mps3_pte_insert(mmu_t mmu, struct pvo_entry *pvo)
|
||||
pvo->pvo_vaddr |= PVO_HID;
|
||||
pvo->pvo_pte.slot = index;
|
||||
|
||||
moea64_pte_valid++;
|
||||
STAT_MOEA64(moea64_pte_valid++);
|
||||
|
||||
if (evicted.pte_hi) {
|
||||
KASSERT((evicted.pte_hi & (LPTE_WIRED | LPTE_LOCKED)) == 0,
|
||||
("Evicted a wired PTE"));
|
||||
moea64_pte_valid--;
|
||||
moea64_pte_overflow++;
|
||||
STAT_MOEA64(moea64_pte_valid--);
|
||||
STAT_MOEA64(moea64_pte_overflow++);
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
@ -364,7 +364,7 @@ mphyp_pte_unset(mmu_t mmu, struct pvo_entry *pvo)
|
||||
("Error removing page: %d", err));
|
||||
|
||||
if (err == H_NOT_FOUND) {
|
||||
moea64_pte_overflow--;
|
||||
STAT_MOEA64(moea64_pte_overflow--);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -485,7 +485,7 @@ mphyp_pte_insert(mmu_t mmu, struct pvo_entry *pvo)
|
||||
result = phyp_pft_hcall(H_REMOVE, H_AVPN, index,
|
||||
evicted.pte_hi & LPTE_AVPN_MASK, 0, &junk, &lastptelo,
|
||||
&junk);
|
||||
moea64_pte_overflow++;
|
||||
STAT_MOEA64(moea64_pte_overflow++);
|
||||
KASSERT(result == H_SUCCESS || result == H_NOT_FOUND,
|
||||
("Error evicting page: %d", (int)result));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user