Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145542541
D13759.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D13759.diff
View Options
Index: vm_glue.c
===================================================================
--- vm_glue.c
+++ vm_glue.c
@@ -842,6 +842,15 @@
SYSCTL_INT(_vm, OID_AUTO, swap_idle_threshold2, CTLFLAG_RW,
&swap_idle_threshold2, 0, "Time before a process will be swapped out");
+/* Long before Unix supported paging, it used process swapping.
+ * While this was ok with the PDP-11/20's 64kB address spaces, it does not work as well today
+ * when address spaces can easily be hundreds of GB.*/
+
+static u_long proc_swapout_max = 65536 ;
+SYSCTL_LONG(_vm, OID_AUTO, proc_swapout_max, CTLFLAG_RW, &proc_swapout_max, 0,
+ "Allows to limit the swapout of whole processes which max resident size (in bytes) is equal or less than value");
+
+
/*
* First, if any processes have been sleeping or stopped for at least
* "swap_idle_threshold1" seconds, they are swapped out. If, however,
@@ -982,11 +991,14 @@
/*
* If the pageout daemon didn't free enough pages,
* or if this process is idle and the system is
- * configured to swap proactively, swap it out.
+ * configured to swap proactively, and the process resident count
+ * is less than vm.proc_swapout_max swap it out.
*/
- if ((action & VM_SWAP_NORMAL) ||
+ if (((vmspace_resident_count(p->p_vmspace) * PAGE_SIZE)
+ <= proc_swapout_max ) &&
+ ((action & VM_SWAP_NORMAL) ||
((action & VM_SWAP_IDLE) &&
- (minslptime > swap_idle_threshold2))) {
+ (minslptime > swap_idle_threshold2)))) {
_PRELE(p);
if (swapout(p) == 0)
didswap++;
@@ -995,6 +1007,7 @@
vmspace_free(vm);
goto retry;
}
+
}
nextproc:
PROC_UNLOCK(p);
@@ -1044,6 +1057,8 @@
p->p_flag |= P_INMEM;
}
+
+
static int
swapout(p)
struct proc *p;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 22, 5:47 AM (7 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28933069
Default Alt Text
D13759.diff (1 KB)
Attached To
Mode
D13759: Remove/Limit whole process swapout
Attached
Detach File
Event Timeline
Log In to Comment