Add a counter for the total number of pages cached and support for

reporting the value of this counter in the program "vmstat".

Approved by:	re (rwatson)
This commit is contained in:
Alan Cox 2007-07-27 20:01:22 +00:00
parent 31a35b79dd
commit eaa29f1ce4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171633
4 changed files with 6 additions and 0 deletions

View File

@ -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 */

View File

@ -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,

View File

@ -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

View File

@ -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);