From 6eb07b4ac29141298bbf2853bf04b3600a804835 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 16 Jan 2003 08:14:56 +0000 Subject: [PATCH] Fix two long-standing, but likely harmless, errors in the use of vm_pageout_deficit: 1. Update vm_pageout_deficit before VM_WAIT. There is no sense in delaying the update; the sooner the pageout daemon receives this information the better. Reviewed by: tegge 2. Update vm_pageout_deficit according to the number of pages still needed to complete the allocation, not the original size of the allocation. Submitted by: tegge (These errors have existed since the introduction of vm_pageout_deficit in revision 1.144.) --- sys/kern/vfs_bio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 01f17955bca3..1f1914ce7ab1 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2756,9 +2756,9 @@ allocbuf(struct buf *bp, int size) m = vm_page_alloc(obj, pi, VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); if (m == NULL) { - VM_WAIT; atomic_add_int(&vm_pageout_deficit, desiredpages - bp->b_npages); + VM_WAIT; } else { vm_page_lock_queues(); vm_page_wakeup(m); @@ -3490,7 +3490,7 @@ tryagain: vm_object_unlock(kernel_object); if (!p) { atomic_add_int(&vm_pageout_deficit, - (to - from) >> PAGE_SHIFT); + (to - pg) >> PAGE_SHIFT); VM_WAIT; goto tryagain; }