aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_pageout.c
diff options
context:
space:
mode:
authorJohn Dyson <dyson@FreeBSD.org>1997-12-04 19:00:56 +0000
committerJohn Dyson <dyson@FreeBSD.org>1997-12-04 19:00:56 +0000
commit12ac6a1dbb4c7739f5b2c8abf2245a0a7bbd8550 (patch)
tree29dbf0fbe738cdd226eb80d03fee9d172e1178eb /sys/vm/vm_pageout.c
parent4bfaee902307104d2018291ea8b1ff217e0145e1 (diff)
downloadsrc-12ac6a1dbb4c7739f5b2c8abf2245a0a7bbd8550.tar.gz
src-12ac6a1dbb4c7739f5b2c8abf2245a0a7bbd8550.zip
Support applications that need to resist or deny use of swap space.
sysctl -w vm.defer_swap_pageouts=1 Causes the system to resist the use of swap space. In low memory conditions, performance will decrease. sysctl -w vm.disable_swap_pageouts=1 Causes the system to mostly disable the use of swap space. In low memory conditions, the system will likely start killing processes.
Notes
Notes: svn path=/head/; revision=31542
Diffstat (limited to 'sys/vm/vm_pageout.c')
-rw-r--r--sys/vm/vm_pageout.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 935b6a92c248..c55de982fb91 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -65,7 +65,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_pageout.c,v 1.99 1997/10/06 02:48:16 dyson Exp $
+ * $Id: vm_pageout.c,v 1.100 1997/10/25 02:41:56 dyson Exp $
*/
/*
@@ -141,6 +141,8 @@ extern int vfs_update_wakeup;
int vm_pageout_stats_max=0, vm_pageout_stats_interval = 0;
int vm_pageout_full_stats_interval = 0;
int vm_pageout_stats_free_max=0, vm_pageout_algorithm_lru=0;
+int defer_swap_pageouts=0;
+int disable_swap_pageouts=0;
#if defined(NO_SWAPPING)
int vm_swapping_enabled=0;
#else
@@ -170,6 +172,12 @@ SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swapping_enabled,
CTLFLAG_RW, &vm_swapping_enabled, 0, "");
#endif
+SYSCTL_INT(_vm, OID_AUTO, defer_swap_pageouts,
+ CTLFLAG_RW, &defer_swap_pageouts, 0, "");
+
+SYSCTL_INT(_vm, OID_AUTO, disable_swap_pageouts,
+ CTLFLAG_RW, &disable_swap_pageouts, 0, "");
+
#define MAXLAUNDER (cnt.v_page_count > 1800 ? 32 : 16)
#define VM_PAGEOUT_PAGE_COUNT 16
@@ -716,6 +724,7 @@ rescan0:
*/
} else if (maxlaunder > 0) {
int written;
+ int swap_pageouts_ok;
struct vnode *vp = NULL;
object = m->object;
@@ -732,6 +741,22 @@ rescan0:
continue;
}
+ if ((object->type != OBJT_SWAP) && (object->type != OBJT_DEFAULT)) {
+ swap_pageouts_ok = 1;
+ } else {
+ swap_pageouts_ok = !(defer_swap_pageouts || disable_swap_pageouts);
+ swap_pageouts_ok |= (!disable_swap_pageouts && defer_swap_pageouts &&
+ (cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min);
+
+ }
+ if (!swap_pageouts_ok) {
+ s = splvm();
+ TAILQ_REMOVE(&vm_page_queue_inactive, m, pageq);
+ TAILQ_INSERT_TAIL(&vm_page_queue_inactive, m, pageq);
+ splx(s);
+ continue;
+ }
+
if (object->type == OBJT_VNODE) {
vp = object->handle;
if (VOP_ISLOCKED(vp) ||
@@ -793,7 +818,6 @@ rescan0:
* start the cleaning operation.
*/
written = vm_pageout_clean(m, 0);
-
if (vp)
vput(vp);