mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-23 17:31:43 +01:00
Fixed a bug I introduced when fixing the rss limit code. Changed swapout
policy to be a bit more selective about what processes get swapped out. Reviewed by: John Dyson
This commit is contained in:
parent
5bdea7c87f
commit
11b224dca2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2692
@ -59,7 +59,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_glue.c,v 1.5 1994/08/09 10:42:41 davidg Exp $
|
||||
* $Id: vm_glue.c,v 1.6 1994/08/18 22:36:01 wollman Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -518,7 +518,11 @@ swapmore:
|
||||
continue;
|
||||
}
|
||||
vm_map_unlock( &p->p_vmspace->vm_map);
|
||||
if (p->p_slptime > maxslp) {
|
||||
/*
|
||||
* If the process has been asleep for awhile and had most
|
||||
* of its pages taken away already, swap it out.
|
||||
*/
|
||||
if ((p->p_slptime > maxslp) && (p->p_vmspace->vm_pmap.pm_stats.resident_count <= 6)) {
|
||||
swapout(p);
|
||||
didswap++;
|
||||
} else if ((tpri = p->p_slptime + p->p_nice * 8) > outpri) {
|
||||
@ -539,7 +543,11 @@ swapmore:
|
||||
p = outp2;
|
||||
}
|
||||
|
||||
if (p) {
|
||||
/*
|
||||
* Only swapout processes that have already had most
|
||||
* of their pages taken away.
|
||||
*/
|
||||
if (p && (p->p_vmspace->vm_pmap.pm_stats.resident_count <= 6)) {
|
||||
swapout(p);
|
||||
didswap = 1;
|
||||
}
|
||||
|
@ -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.10 1994/09/06 11:28:46 davidg Exp $
|
||||
* $Id: vm_pageout.c,v 1.11 1994/09/12 11:31:36 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -541,8 +541,7 @@ redeact:
|
||||
|
||||
morefree:
|
||||
/*
|
||||
* now check malloc area or swap processes out if we are in low
|
||||
* memory conditions
|
||||
* now swap processes out if we are in low memory conditions
|
||||
*/
|
||||
if (cnt.v_free_count <= cnt.v_free_min) {
|
||||
/*
|
||||
@ -550,6 +549,7 @@ morefree:
|
||||
*/
|
||||
swapout_threads();
|
||||
}
|
||||
|
||||
/*
|
||||
* scan the processes for exceeding their rlimits or if process
|
||||
* is swapped out -- deactivate pages
|
||||
@ -591,7 +591,7 @@ rescanproc1:
|
||||
limit = 0;
|
||||
|
||||
size = p->p_vmspace->vm_pmap.pm_stats.resident_count * NBPG;
|
||||
if (limit > 0 && size >= limit) {
|
||||
if (limit >= 0 && size >= limit) {
|
||||
overage = (size - limit) / NBPG;
|
||||
vm_pageout_map_deactivate_pages(&p->p_vmspace->vm_map,
|
||||
(vm_map_entry_t) 0, &overage, vm_pageout_object_deactivate_pages);
|
||||
@ -705,7 +705,6 @@ rescan1:
|
||||
m = next;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute the page shortage. If we are still very low on memory
|
||||
* be sure that we will move a minimal amount of pages from active
|
||||
|
Loading…
Reference in New Issue
Block a user