summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/sys/vmmeter.h
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/sys/vmmeter.h')
-rw-r--r--freebsd/sys/sys/vmmeter.h61
1 files changed, 28 insertions, 33 deletions
diff --git a/freebsd/sys/sys/vmmeter.h b/freebsd/sys/sys/vmmeter.h
index c66016c6..39f03d0d 100644
--- a/freebsd/sys/sys/vmmeter.h
+++ b/freebsd/sys/sys/vmmeter.h
@@ -46,7 +46,7 @@
* c - constant after initialization
* f - locked by vm_page_queue_free_mtx
* p - locked by being in the PCPU and atomicity respect to interrupts
- * q - locked by vm_page_queue_mtx
+ * q - changes are synchronized by the corresponding vm_pagequeue lock
*/
struct vmmeter {
/*
@@ -61,6 +61,7 @@ struct vmmeter {
* Virtual memory activity.
*/
u_int v_vm_faults; /* (p) address memory faults */
+ u_int v_io_faults; /* (p) page faults requiring I/O */
u_int v_cow_faults; /* (p) copy-on-writes faults */
u_int v_cow_optim; /* (p) optimized copy-on-writes faults */
u_int v_zfod; /* (p) pages zero filled on demand */
@@ -75,8 +76,8 @@ struct vmmeter {
u_int v_vnodepgsout; /* (p) vnode pager pages paged out */
u_int v_intrans; /* (p) intransit blocking page faults */
u_int v_reactivated; /* (f) pages reactivated from free list */
- u_int v_pdwakeups; /* (f) times daemon has awaken from sleep */
- u_int v_pdpages; /* (q) pages analyzed by daemon */
+ u_int v_pdwakeups; /* (p) times daemon has awaken from sleep */
+ u_int v_pdpages; /* (p) pages analyzed by daemon */
u_int v_tcached; /* (p) total pages cached */
u_int v_dfree; /* (p) pages freed by daemon */
@@ -96,8 +97,6 @@ struct vmmeter {
u_int v_inactive_target; /* (c) pages desired inactive */
u_int v_inactive_count; /* (q) pages inactive */
u_int v_cache_count; /* (f) pages on cache queue */
- u_int v_cache_min; /* (c) min pages desired on cache queue */
- u_int v_cache_max; /* (c) max pages in cached obj */
u_int v_pageout_free_min; /* (c) min pages reserved for kernel */
u_int v_interrupt_free_min; /* (c) reserved pages for int code */
u_int v_free_severe; /* (c) severe page depletion point */
@@ -112,10 +111,13 @@ struct vmmeter {
u_int v_vforkpages; /* (p) VM pages affected by vfork() */
u_int v_rforkpages; /* (p) VM pages affected by rfork() */
u_int v_kthreadpages; /* (p) VM pages affected by fork() by kernel */
+ u_int v_spare[2];
};
#ifdef _KERNEL
-extern struct vmmeter cnt;
+extern struct vmmeter vm_cnt;
+
+extern u_int vm_pageout_wakeup_thresh;
/*
* Return TRUE if we are under our severe low-free-pages threshold
@@ -123,12 +125,12 @@ extern struct vmmeter cnt;
* This routine is typically used at the user<->system interface to determine
* whether we need to block in order to avoid a low memory deadlock.
*/
-
-static __inline
-int
+static inline int
vm_page_count_severe(void)
{
- return (cnt.v_free_severe > (cnt.v_free_count + cnt.v_cache_count));
+
+ return (vm_cnt.v_free_severe > vm_cnt.v_free_count +
+ vm_cnt.v_cache_count);
}
/*
@@ -138,55 +140,48 @@ vm_page_count_severe(void)
* we can execute potentially very expensive code in terms of memory. It
* is also used by the pageout daemon to calculate when to sleep, when
* to wake waiters up, and when (after making a pass) to become more
- * desparate.
+ * desperate.
*/
-
-static __inline
-int
+static inline int
vm_page_count_min(void)
{
- return (cnt.v_free_min > (cnt.v_free_count + cnt.v_cache_count));
+
+ return (vm_cnt.v_free_min > vm_cnt.v_free_count + vm_cnt.v_cache_count);
}
/*
* Return TRUE if we have not reached our free page target during
* free page recovery operations.
*/
-
-static __inline
-int
+static inline int
vm_page_count_target(void)
{
- return (cnt.v_free_target > (cnt.v_free_count + cnt.v_cache_count));
+
+ return (vm_cnt.v_free_target > vm_cnt.v_free_count +
+ vm_cnt.v_cache_count);
}
/*
* Return the number of pages we need to free-up or cache
* A positive number indicates that we do not have enough free pages.
*/
-
-static __inline
-int
+static inline int
vm_paging_target(void)
{
- return (
- (cnt.v_free_target + cnt.v_cache_min) -
- (cnt.v_free_count + cnt.v_cache_count)
- );
+
+ return (vm_cnt.v_free_target - (vm_cnt.v_free_count +
+ vm_cnt.v_cache_count));
}
/*
* Returns TRUE if the pagedaemon needs to be woken up.
*/
-
-static __inline
-int
+static inline int
vm_paging_needed(void)
{
- return (
- (cnt.v_free_reserved + cnt.v_cache_min) >
- (cnt.v_free_count + cnt.v_cache_count)
- );
+
+ return (vm_cnt.v_free_count + vm_cnt.v_cache_count <
+ vm_pageout_wakeup_thresh);
}
#endif