1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
/* $OpenBSD: uvmexp.h,v 1.10 2022/08/29 11:09:31 mpi Exp $ */
#ifndef _UVM_UVMEXP_
#define _UVM_UVMEXP_
/*
* CTL_VM identifiers
*/
#define VM_METER 1 /* struct vmmeter */
#define VM_LOADAVG 2 /* struct loadavg */
#define VM_PSSTRINGS 3 /* PSSTRINGS */
#define VM_UVMEXP 4 /* struct uvmexp */
#define VM_SWAPENCRYPT 5 /* int */
#define VM_NKMEMPAGES 6 /* int - # kmem_map pages */
#define VM_ANONMIN 7
#define VM_VTEXTMIN 8
#define VM_VNODEMIN 9
#define VM_MAXSLP 10
#define VM_USPACE 11
#define VM_MALLOC_CONF 12 /* config for userland malloc */
#define VM_MAXID 13 /* number of valid vm ids */
#define CTL_VM_NAMES { \
{ 0, 0 }, \
{ "vmmeter", CTLTYPE_STRUCT }, \
{ "loadavg", CTLTYPE_STRUCT }, \
{ "psstrings", CTLTYPE_STRUCT }, \
{ "uvmexp", CTLTYPE_STRUCT }, \
{ "swapencrypt", CTLTYPE_NODE }, \
{ "nkmempages", CTLTYPE_INT }, \
{ "anonmin", CTLTYPE_INT }, \
{ "vtextmin", CTLTYPE_INT }, \
{ "vnodemin", CTLTYPE_INT }, \
{ "maxslp", CTLTYPE_INT }, \
{ "uspace", CTLTYPE_INT }, \
{ "malloc_conf", CTLTYPE_STRING }, \
}
/*
* uvmexp: global data structures that are exported to parts of the kernel
* other than the vm system.
*
* Locks used to protect struct members in this file:
* a atomic operations
* I immutable after creation
* K kernel lock
* F uvm_lock_fpageq
* S uvm_swap_data_lock
*/
struct uvmexp {
/* vm_page constants */
int pagesize; /* size of a page (PAGE_SIZE): must be power of 2 */
int pagemask; /* page mask */
int pageshift; /* page shift */
/* vm_page counters */
int npages; /* [I] number of pages we manage */
int free; /* [F] number of free pages */
int active; /* number of active pages */
int inactive; /* number of pages that we free'd but may want back */
int paging; /* number of pages in the process of being paged out */
int wired; /* number of wired pages */
int zeropages; /* [F] number of zero'd pages */
int reserve_pagedaemon; /* [I] # of pages reserved for pagedaemon */
int reserve_kernel; /* [I] # of pages reserved for kernel */
int unused01; /* formerly anonpages */
int vnodepages; /* XXX # of pages used by vnode page cache */
int vtextpages; /* XXX # of pages used by vtext vnodes */
/* pageout params */
int freemin; /* min number of free pages */
int freetarg; /* target number of free pages */
int inactarg; /* target number of inactive pages */
int wiredmax; /* max number of wired pages */
int anonmin; /* min threshold for anon pages */
int vtextmin; /* min threshold for vtext pages */
int vnodemin; /* min threshold for vnode pages */
int anonminpct; /* min percent anon pages */
int vtextminpct;/* min percent vtext pages */
int vnodeminpct;/* min percent vnode pages */
/* swap */
int nswapdev; /* [S] number of configured swap devices in system */
int swpages; /* [S] number of PAGE_SIZE'ed swap pages */
int swpginuse; /* [K] number of swap pages in use */
int swpgonly; /* [a] number of swap pages in use, not also in RAM */
int nswget; /* [a] number of swap pages moved from disk to RAM */
int nanon; /* XXX number total of anon's in system */
int unused05; /* formerly nanonneeded */
int unused06; /* formerly nfreeanon */
/* stat counters */
int faults; /* page fault count */
int traps; /* trap count */
int intrs; /* interrupt count */
int swtch; /* context switch count */
int softs; /* software interrupt count */
int syscalls; /* system calls */
int pageins; /* pagein operation count */
/* pageouts are in pdpageouts below */
int unused07; /* formerly obsolete_swapins */
int unused08; /* formerly obsolete_swapouts */
int pgswapin; /* pages swapped in */
int pgswapout; /* pages swapped out */
int forks; /* forks */
int forks_ppwait; /* forks where parent waits */
int forks_sharevm; /* forks where vmspace is shared */
int pga_zerohit; /* pagealloc where zero wanted and zero
was available */
int pga_zeromiss; /* pagealloc where zero wanted and zero
not available */
int unused09; /* formerly zeroaborts */
/* fault subcounters */
int fltnoram; /* number of times fault was out of ram */
int fltnoanon; /* number of times fault was out of anons */
int fltnoamap; /* number of times fault was out of amap chunks */
int fltpgwait; /* number of times fault had to wait on a page */
int fltpgrele; /* number of times fault found a released page */
int fltrelck; /* number of times fault relock called */
int fltrelckok; /* number of times fault relock is a success */
int fltanget; /* number of times fault gets anon page */
int fltanretry; /* number of times fault retrys an anon get */
int fltamcopy; /* number of times fault clears "needs copy" */
int fltnamap; /* number of times fault maps a neighbor anon page */
int fltnomap; /* number of times fault maps a neighbor obj page */
int fltlget; /* number of times fault does a locked pgo_get */
int fltget; /* number of times fault does an unlocked get */
int flt_anon; /* number of times fault anon (case 1a) */
int flt_acow; /* number of times fault anon cow (case 1b) */
int flt_obj; /* number of times fault is on object page (2a) */
int flt_prcopy; /* number of times fault promotes with copy (2b) */
int flt_przero; /* number of times fault promotes with zerofill (2b) */
/* daemon counters */
int pdwoke; /* number of times daemon woke up */
int pdrevs; /* number of times daemon rev'd clock hand */
int pdswout; /* number of times daemon called for swapout */
int pdfreed; /* number of pages daemon freed since boot */
int pdscans; /* number of pages daemon scanned since boot */
int pdanscan; /* number of anonymous pages scanned by daemon */
int pdobscan; /* number of object pages scanned by daemon */
int pdreact; /* number of pages daemon reactivated since boot */
int pdbusy; /* number of times daemon found a busy page */
int pdpageouts; /* number of times daemon started a pageout */
int pdpending; /* number of times daemon got a pending pagout */
int pddeact; /* number of pages daemon deactivates */
int unused11; /* formerly pdreanon */
int unused12; /* formerly pdrevnode */
int unused13; /* formerly pdrevtext */
int fpswtch; /* FPU context switches */
int kmapent; /* number of kernel map entries */
};
struct _ps_strings {
void *val;
};
#ifdef _KERNEL
/*
* Per-cpu UVM counters.
*/
extern struct cpumem *uvmexp_counters;
enum uvm_exp_counters {
/* stat counters */
faults, /* page fault count */
pageins, /* pagein operation count */
/* fault subcounters */
flt_noram, /* number of times fault was out of ram */
flt_noanon, /* number of times fault was out of anons */
flt_noamap, /* number of times fault was out of amap chunks */
flt_pgwait, /* number of times fault had to wait on a page */
flt_pgrele, /* number of times fault found a released page */
flt_relck, /* number of times fault relock called */
flt_relckok, /* number of times fault relock is a success */
flt_anget, /* number of times fault gets anon page */
flt_anretry, /* number of times fault retrys an anon get */
flt_amcopy, /* number of times fault clears "needs copy" */
flt_namap, /* number of times fault maps a neighbor anon page */
flt_nomap, /* number of times fault maps a neighbor obj page */
flt_lget, /* number of times fault does a locked pgo_get */
flt_get, /* number of times fault does an unlocked get */
flt_anon, /* number of times fault anon (case 1a) */
flt_acow, /* number of times fault anon cow (case 1b) */
flt_obj, /* number of times fault is on object page (2a) */
flt_prcopy, /* number of times fault promotes with copy (2b) */
flt_przero, /* number of times fault promotes with zerofill (2b) */
exp_ncounters
};
#endif /* _KERNEL */
#endif /*_UVM_UVMEXP_ */
|