mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 11:14:18 +01:00
riscv: support PV_STATS pmap option
It is rarely used but trivially supported; add the missing stat calls and enable it in LINT. Reviewed by: markj, br (previous version), jhb (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45475
This commit is contained in:
parent
0a9aa6fdf5
commit
88d81453b1
@ -1,3 +1,3 @@
|
||||
|
||||
RISCV opt_global.h # For cpu RISCV to work
|
||||
INTRNG opt_global.h
|
||||
PV_STATS opt_pmap.h
|
||||
|
@ -17,6 +17,9 @@ options KDTRACE_HOOKS # Kernel DTrace hooks
|
||||
options DDB_CTF # Kernel ELF linker loads CTF data
|
||||
options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default
|
||||
|
||||
# Enable detailed accounting by the PV entry allocator.
|
||||
options PV_STATS
|
||||
|
||||
# RISC-V SBI console
|
||||
device rcons
|
||||
|
||||
|
@ -93,7 +93,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
/*
|
||||
* Manages physical address maps.
|
||||
*
|
||||
@ -113,6 +112,8 @@
|
||||
* and to when physical maps must be made correct.
|
||||
*/
|
||||
|
||||
#include "opt_pmap.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bitstring.h>
|
||||
@ -1891,7 +1892,6 @@ static const uint64_t pc_freemask[_NPCM] = {
|
||||
[_NPCM - 1] = PC_FREEL
|
||||
};
|
||||
|
||||
#if 0
|
||||
#ifdef PV_STATS
|
||||
static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail;
|
||||
|
||||
@ -1916,7 +1916,6 @@ SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0,
|
||||
SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0,
|
||||
"Current number of spare pv entries");
|
||||
#endif
|
||||
#endif /* 0 */
|
||||
|
||||
/*
|
||||
* We are in a serious low memory condition. Resort to
|
||||
@ -2101,7 +2100,8 @@ retry:
|
||||
goto retry;
|
||||
reclaimed = true;
|
||||
}
|
||||
/* XXX PV STATS */
|
||||
PV_STAT(atomic_add_int(&pc_chunk_count, 1));
|
||||
PV_STAT(atomic_add_int(&pc_chunk_allocs, 1));
|
||||
#if 0
|
||||
dump_add_page(m->phys_addr);
|
||||
#endif
|
||||
@ -2112,6 +2112,7 @@ retry:
|
||||
pc->pc_map[2] = PC_FREEL;
|
||||
TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
|
||||
TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru);
|
||||
PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV));
|
||||
|
||||
/*
|
||||
* The reclaim might have freed a chunk from the current pmap.
|
||||
@ -2222,6 +2223,7 @@ pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
|
||||
TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next);
|
||||
m->md.pv_gen++;
|
||||
/* Instantiate the remaining 511 pv entries. */
|
||||
PV_STAT(atomic_add_long(&pv_entry_allocs, Ln_ENTRIES - 1));
|
||||
va_last = va + L2_SIZE - PAGE_SIZE;
|
||||
for (;;) {
|
||||
pc = TAILQ_FIRST(&pmap->pm_pvchunk);
|
||||
@ -2250,7 +2252,8 @@ out:
|
||||
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
||||
TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list);
|
||||
}
|
||||
/* XXX PV stats */
|
||||
PV_STAT(atomic_add_long(&pv_entry_count, Ln_ENTRIES - 1));
|
||||
PV_STAT(atomic_add_int(&pv_entry_spare, -(Ln_ENTRIES - 1)));
|
||||
}
|
||||
|
||||
#if VM_NRESERVLEVEL > 0
|
||||
|
Loading…
Reference in New Issue
Block a user