Page MenuHomeFreeBSD

D56142.id174470.diff
No OneTemporary

D56142.id174470.diff

diff --git a/sys/conf/files b/sys/conf/files
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -5356,7 +5356,7 @@
vm/vm_phys.c standard
vm/vm_radix.c standard
vm/vm_reserv.c standard
-vm/vm_swapout.c optional racct
+vm/vm_swapout.c standard
vm/vm_unix.c standard
vm/vnode_pager.c standard
xen/features.c optional xenhvm
diff --git a/sys/vm/vm_pageout.h b/sys/vm/vm_pageout.h
--- a/sys/vm/vm_pageout.h
+++ b/sys/vm/vm_pageout.h
@@ -103,5 +103,7 @@
int vm_pageout_flush(vm_page_t *mc, int count, int flags, bool *eio);
void vm_pageout_oom(int shortage);
+void vm_swapout_run(void);
+
#endif /* _KERNEL */
#endif /* _VM_VM_PAGEOUT_H_ */
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1683,7 +1683,7 @@
* results to present a coherent view of paging activity on this domain.
*/
static int
-vm_pageout_inactive_dispatch(struct vm_domain *vmd, int shortage)
+vm_pageout_inactive_dispatch(struct vm_domain *vmd, u_int shortage)
{
u_int freed, pps, slop, threads, us;
@@ -1796,6 +1796,9 @@
*/
vm_pageout_mightbe_oom(vmd, page_shortage, starting_page_shortage);
+ if (page_shortage > 0)
+ vm_swapout_run();
+
/*
* See the description of addl_page_shortage above.
*/
diff --git a/sys/vm/vm_swapout.c b/sys/vm/vm_swapout.c
--- a/sys/vm/vm_swapout.c
+++ b/sys/vm/vm_swapout.c
@@ -135,6 +135,20 @@
static void vm_swapout_map_deactivate_pages(vm_map_t, long);
static void vm_swapout_object_deactivate(pmap_t, vm_object_t, long);
+void
+vm_swapout_run(void)
+{
+ static int lastrun = 0;
+
+ mtx_lock(&vm_daemon_mtx);
+ vm_daemon_needed = 1;
+ if (ticks - lastrun >= hz || ticks < lastrun) {
+ wakeup(&vm_daemon_needed);
+ lastrun = ticks;
+ }
+ mtx_unlock(&vm_daemon_mtx);
+}
+
static void
vm_swapout_object_deactivate_page(pmap_t pmap, vm_page_t m, bool unmap)
{
@@ -287,7 +301,7 @@
if (racct_enable && vm_daemon_timeout == 0)
vm_daemon_timeout = hz;
- while (TRUE) {
+ while (true) {
mtx_lock(&vm_daemon_mtx);
msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep",
vm_daemon_timeout);

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 19, 9:51 PM (20 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31748711
Default Alt Text
D56142.id174470.diff (2 KB)

Event Timeline