- Update vm_pageout_deficit using atomic operations. It's a simple

counter outside the scope of existing locks.
 - Eliminate a redundant clearing of vm_pageout_deficit.
This commit is contained in:
Alan Cox 2003-01-14 06:57:03 +00:00
parent ab099bd309
commit b0ef8c5fe4
3 changed files with 7 additions and 7 deletions

View File

@ -2757,7 +2757,8 @@ allocbuf(struct buf *bp, int size)
VM_ALLOC_SYSTEM | VM_ALLOC_WIRED);
if (m == NULL) {
VM_WAIT;
vm_pageout_deficit += desiredpages - bp->b_npages;
atomic_add_int(&vm_pageout_deficit,
desiredpages - bp->b_npages);
} else {
vm_page_lock_queues();
vm_page_wakeup(m);
@ -3488,7 +3489,8 @@ vm_hold_load_pages(struct buf * bp, vm_offset_t from, vm_offset_t to)
VM_ALLOC_SYSTEM | VM_ALLOC_WIRED);
vm_object_unlock(kernel_object);
if (!p) {
vm_pageout_deficit += (to - from) >> PAGE_SHIFT;
atomic_add_int(&vm_pageout_deficit,
(to - from) >> PAGE_SHIFT);
VM_WAIT;
goto tryagain;
}

View File

@ -805,7 +805,7 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
if (cnt.v_cache_count > 0)
printf("vm_page_alloc(NORMAL): missing pages on cache queue: %d\n", cnt.v_cache_count);
#endif
vm_pageout_deficit++;
atomic_add_int(&vm_pageout_deficit, 1);
pagedaemon_wakeup();
return (NULL);
}
@ -821,7 +821,7 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
*/
mtx_unlock_spin(&vm_page_queue_free_mtx);
splx(s);
vm_pageout_deficit++;
atomic_add_int(&vm_pageout_deficit, 1);
pagedaemon_wakeup();
return (NULL);
}

View File

@ -694,8 +694,7 @@ vm_pageout_scan(int pass)
*/
vm_pageout_pmap_collect();
addl_page_shortage_init = vm_pageout_deficit;
vm_pageout_deficit = 0;
addl_page_shortage_init = atomic_readandclear_int(&vm_pageout_deficit);
/*
* Calculate the number of pages we want to either free or move
@ -1479,7 +1478,6 @@ vm_pageout()
cnt.v_pdwakeups++;
splx(s);
vm_pageout_scan(pass);
vm_pageout_deficit = 0;
}
}