diff --git a/sys/sys/vmmeter.h b/sys/sys/vmmeter.h index 6caba18b94f2..bdd196464357 100644 --- a/sys/sys/vmmeter.h +++ b/sys/sys/vmmeter.h @@ -72,6 +72,7 @@ struct vmmeter { u_int v_pdwakeups; /* (f) times daemon has awaken from sleep */ u_int v_pdpages; /* (q) pages analyzed by daemon */ + u_int v_tcached; /* (q) total pages cached */ u_int v_dfree; /* (q) pages freed by daemon */ u_int v_pfree; /* (q) pages freed by exiting processes */ u_int v_tfree; /* (p) total pages freed */ diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index e52ab9647e8a..d949fbf7a63f 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -329,6 +329,8 @@ SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pdwakeups, CTLTYPE_UINT|CTLFLAG_RD, &cnt.v_pdwakeups, 0, vcnt, "IU", "Pagedaemon wakeups"); SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pdpages, CTLTYPE_UINT|CTLFLAG_RD, &cnt.v_pdpages, 0, vcnt, "IU", "Pagedaemon page scans"); +SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_tcached, CTLTYPE_UINT|CTLFLAG_RD, + &cnt.v_tcached, 0, vcnt, "IU", "Total pages cached"); SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_dfree, CTLTYPE_UINT|CTLFLAG_RD, &cnt.v_dfree, 0, vcnt, "IU", ""); SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pfree, CTLTYPE_UINT|CTLFLAG_RD, diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 750e2958f6b5..6504f604c1c7 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1363,6 +1363,7 @@ vm_page_cache(vm_page_t m) } if (VM_PAGE_INQUEUE1(m, PQ_CACHE)) return; + cnt.v_tcached++; /* * Remove all pmaps and indicate that the page is not diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index efd5b79945ef..28d45c02c2af 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -441,6 +441,7 @@ fill_vmmeter(struct vmmeter *vmmp) GET_VM_STATS(vm, v_reactivated); GET_VM_STATS(vm, v_pdwakeups); GET_VM_STATS(vm, v_pdpages); + GET_VM_STATS(vm, v_tcached); GET_VM_STATS(vm, v_dfree); GET_VM_STATS(vm, v_pfree); GET_VM_STATS(vm, v_tfree); @@ -721,6 +722,7 @@ dosum(void) (void)printf("%9u pages affected by fork()\n", sum.v_forkpages); (void)printf("%9u pages affected by vfork()\n", sum.v_vforkpages); (void)printf("%9u pages affected by rfork()\n", sum.v_rforkpages); + (void)printf("%9u pages cached\n", sum.v_tcached); (void)printf("%9u pages freed\n", sum.v_tfree); (void)printf("%9u pages freed by daemon\n", sum.v_dfree); (void)printf("%9u pages freed by exiting processes\n", sum.v_pfree);