aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/vmmeter.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2017-10-13 21:54:34 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2017-10-13 21:54:34 +0000
commit1dbf52e7d9ee86ea5c5263cd2891eb2d88ffe27f (patch)
treec7545e9dc43146fecb47f736cbc586cc28542729 /sys/sys/vmmeter.h
parent30a33cefae59195f655dfdc40781ff7a8ca8e046 (diff)
downloadsrc-1dbf52e7d9ee86ea5c5263cd2891eb2d88ffe27f.tar.gz
src-1dbf52e7d9ee86ea5c5263cd2891eb2d88ffe27f.zip
Reduce traffic on vm_cnt.v_free_count
The variable is modified with the highly contended page free queue lock. It unnecessarily shares a cacheline with purely read-only fields and is re-read after the lock is dropped in the page allocation code making the hold time longer. Pad the variable just like the others and store the value as found with the lock held instead of re-reading. Provides a modest 1%-ish speed up in concurrent page faults. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D12665
Notes
Notes: svn path=/head/; revision=324610
Diffstat (limited to 'sys/sys/vmmeter.h')
-rw-r--r--sys/sys/vmmeter.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/sys/vmmeter.h b/sys/sys/vmmeter.h
index bc536f71e7b5..c36a0addb3b2 100644
--- a/sys/sys/vmmeter.h
+++ b/sys/sys/vmmeter.h
@@ -131,7 +131,6 @@ struct vmmeter {
u_int v_free_reserved; /* (c) pages reserved for deadlock */
u_int v_free_target; /* (c) pages desired free */
u_int v_free_min; /* (c) pages desired free */
- u_int v_free_count; /* (f) pages free */
u_int v_inactive_target; /* (c) pages desired inactive */
u_int v_pageout_free_min; /* (c) min pages reserved for kernel */
u_int v_interrupt_free_min; /* (c) reserved pages for int code */
@@ -141,6 +140,7 @@ struct vmmeter {
u_int v_inactive_count VMMETER_ALIGNED; /* (a) pages inactive */
u_int v_laundry_count VMMETER_ALIGNED; /* (a) pages eligible for
laundering */
+ u_int v_free_count VMMETER_ALIGNED; /* (a) pages free */
};
#endif /* _KERNEL || _WANT_VMMETER */
@@ -208,10 +208,10 @@ vm_paging_target(void)
* Returns TRUE if the pagedaemon needs to be woken up.
*/
static inline int
-vm_paging_needed(void)
+vm_paging_needed(u_int free_count)
{
- return (vm_cnt.v_free_count < vm_pageout_wakeup_thresh);
+ return (free_count < vm_pageout_wakeup_thresh);
}
/*