Index: sys/vm/vm_pageout.c =================================================================== --- sys/vm/vm_pageout.c +++ sys/vm/vm_pageout.c @@ -1649,25 +1649,26 @@ /* * Dispatch a number of inactive threads according to load and collect the - * results to prevent a coherent (CEM: incoherent?) view of paging activity on - * this domain. + * results to present a coherent view of paging activity on this domain. */ static int vm_pageout_inactive_dispatch(struct vm_domain *vmd, int shortage) { - u_int freed, pps, threads, us; + u_int freed, pps, slop, threads, us; vmd->vmd_inactive_shortage = shortage; + slop = 0; /* * If we have more work than we can do in a quarter of our interval, we * fire off multiple threads to process it. */ - if (vmd->vmd_inactive_threads > 1 && vmd->vmd_inactive_pps != 0 && + threads = vmd->vmd_inactive_threads; + if (threads > 1 && vmd->vmd_inactive_pps != 0 && shortage > vmd->vmd_inactive_pps / VM_INACT_SCAN_RATE / 4) { - threads = vmd->vmd_inactive_threads; - vm_domain_pageout_lock(vmd); vmd->vmd_inactive_shortage /= threads; + slop = shortage % threads; + vm_domain_pageout_lock(vmd); blockcount_acquire(&vmd->vmd_inactive_starting, threads - 1); blockcount_acquire(&vmd->vmd_inactive_running, threads - 1); wakeup(&vmd->vmd_inactive_shortage); @@ -1675,7 +1676,7 @@ } /* Run the local thread scan. */ - vm_pageout_scan_inactive(vmd, vmd->vmd_inactive_shortage); + vm_pageout_scan_inactive(vmd, vmd->vmd_inactive_shortage + slop); /* * Block until helper threads report results and then accumulate