Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107081177
D45475.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D45475.diff
View Options
diff --git a/sys/conf/options.riscv b/sys/conf/options.riscv
--- a/sys/conf/options.riscv
+++ b/sys/conf/options.riscv
@@ -1,3 +1,3 @@
-
RISCV opt_global.h # For cpu RISCV to work
INTRNG opt_global.h
+PV_STATS opt_pmap.h
diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES
--- a/sys/riscv/conf/NOTES
+++ b/sys/riscv/conf/NOTES
@@ -17,6 +17,9 @@
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
diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -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 @@
[_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_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 @@
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 @@
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 @@
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 @@
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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 10, 7:56 PM (15 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15745950
Default Alt Text
D45475.diff (2 KB)
Attached To
Mode
D45475: riscv: support PV_STATS pmap option
Attached
Detach File
Event Timeline
Log In to Comment