vm_page.c:
Use request==VM_ALLOC_NORMAL rather than object!=kmem_object in deciding if the caller is "important" in vm_page_alloc(). Also established a new low threshold for non-interrupt allocations via cnt.v_interrupt_free_min. vm_pageout.c: Various algorithmic cleanup. Some calculations simplified. Initialize cnt.v_interrupt_free_min to 2 pages. Submitted by: John Dyson
This commit is contained in:
parent
47c0ade484
commit
ae47cb7fd4
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91
|
||||
* $Id: vm_page.c,v 1.20 1995/02/20 14:00:50 davidg Exp $
|
||||
* $Id: vm_page.c,v 1.21 1995/02/22 10:16:21 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -620,21 +620,19 @@ vm_page_alloc(object, offset, page_req)
|
||||
{
|
||||
register vm_page_t mem;
|
||||
int s;
|
||||
int msgflg;
|
||||
|
||||
simple_lock(&vm_page_queue_free_lock);
|
||||
|
||||
s = splhigh();
|
||||
|
||||
if (((cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_reserved) &&
|
||||
object != kernel_object &&
|
||||
object != kmem_object &&
|
||||
curproc != pageproc &&
|
||||
curproc != &proc0) {
|
||||
(page_req == VM_ALLOC_NORMAL) &&
|
||||
(curproc != pageproc)) {
|
||||
simple_unlock(&vm_page_queue_free_lock);
|
||||
splx(s);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (page_req == VM_ALLOC_INTERRUPT) {
|
||||
if ((mem = vm_page_queue_free.tqh_first) == 0) {
|
||||
simple_unlock(&vm_page_queue_free_lock);
|
||||
@ -656,7 +654,8 @@ vm_page_alloc(object, offset, page_req)
|
||||
goto gotpage;
|
||||
}
|
||||
|
||||
if( page_req == VM_ALLOC_SYSTEM) {
|
||||
if (page_req == VM_ALLOC_SYSTEM &&
|
||||
cnt.v_free_count > cnt.v_interrupt_free_min) {
|
||||
mem = vm_page_queue_free.tqh_first;
|
||||
}
|
||||
|
||||
|
@ -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.36 1995/02/20 23:35:45 davidg Exp $
|
||||
* $Id: vm_pageout.c,v 1.37 1995/02/22 09:15:32 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -496,7 +496,6 @@ vm_pageout_scan()
|
||||
vm_page_t m;
|
||||
int page_shortage, maxscan, maxlaunder;
|
||||
int pages_freed;
|
||||
int desired_free;
|
||||
vm_page_t next;
|
||||
struct proc *p, *bigproc;
|
||||
vm_offset_t size, bigsize;
|
||||
@ -518,7 +517,6 @@ vm_pageout_scan()
|
||||
vm_req_vmdaemon();
|
||||
}
|
||||
pages_freed = 0;
|
||||
desired_free = cnt.v_free_target;
|
||||
|
||||
/*
|
||||
* Start scanning the inactive queue for pages we can free. We keep
|
||||
@ -534,7 +532,7 @@ vm_pageout_scan()
|
||||
maxscan = min(cnt.v_inactive_count, MAXSCAN);
|
||||
m = vm_page_queue_inactive.tqh_first;
|
||||
while (m && (maxscan-- > 0) &&
|
||||
((cnt.v_free_count + cnt.v_cache_count) < desired_free)) {
|
||||
(cnt.v_cache_count < (cnt.v_cache_min + cnt.v_free_target))) {
|
||||
vm_page_t next;
|
||||
|
||||
cnt.v_pdpages++;
|
||||
@ -580,8 +578,7 @@ vm_pageout_scan()
|
||||
if (m->valid == 0) {
|
||||
pmap_page_protect(VM_PAGE_TO_PHYS(m), VM_PROT_NONE);
|
||||
vm_page_free(m);
|
||||
} else if (((cnt.v_free_count + cnt.v_cache_count) < desired_free) ||
|
||||
(cnt.v_cache_count < cnt.v_cache_min)) {
|
||||
} else {
|
||||
vm_page_cache(m);
|
||||
}
|
||||
} else if (maxlaunder > 0) {
|
||||
@ -626,13 +623,8 @@ vm_pageout_scan()
|
||||
(cnt.v_free_count + cnt.v_inactive_count + cnt.v_cache_count);
|
||||
if (page_shortage <= 0) {
|
||||
if (pages_freed == 0) {
|
||||
if ((cnt.v_free_count + cnt.v_cache_count) < desired_free) {
|
||||
page_shortage =
|
||||
desired_free - (cnt.v_free_count + cnt.v_cache_count);
|
||||
}
|
||||
page_shortage = cnt.v_free_min - cnt.v_inactive_count;
|
||||
}
|
||||
if( (page_shortage <= 0) && (cnt.v_free_count < cnt.v_free_min))
|
||||
page_shortage = 1;
|
||||
}
|
||||
maxscan = min(cnt.v_active_count, MAXSCAN);
|
||||
m = vm_page_queue_active.tqh_first;
|
||||
@ -781,22 +773,24 @@ vm_pageout()
|
||||
cnt.v_pageout_free_min = 6 + cnt.v_page_count / 1024;
|
||||
cnt.v_free_reserved = cnt.v_pageout_free_min + 2;
|
||||
cnt.v_free_target = 3 * cnt.v_free_min + cnt.v_free_reserved;
|
||||
cnt.v_inactive_target = cnt.v_free_count / 4;
|
||||
if (cnt.v_inactive_target > 512)
|
||||
cnt.v_inactive_target = 512;
|
||||
cnt.v_free_min += cnt.v_free_reserved;
|
||||
|
||||
if (cnt.v_page_count > 1024) {
|
||||
cnt.v_cache_max = (cnt.v_free_count - 1024) / 2;
|
||||
cnt.v_cache_min = (cnt.v_free_count - 1024) / 20;
|
||||
cnt.v_cache_min = (cnt.v_free_count - 1024) / 8;
|
||||
cnt.v_inactive_target = 2*cnt.v_cache_min + 192;
|
||||
} else {
|
||||
cnt.v_cache_min = 0;
|
||||
cnt.v_cache_max = 0;
|
||||
cnt.v_inactive_target = cnt.v_free_count / 4;
|
||||
}
|
||||
|
||||
/* XXX does not really belong here */
|
||||
if (vm_page_max_wired == 0)
|
||||
vm_page_max_wired = cnt.v_free_count / 3;
|
||||
|
||||
cnt.v_interrupt_free_min = 2;
|
||||
|
||||
|
||||
(void) swap_pager_alloc(0, 0, 0, 0);
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user