Date: Tue, 26 Aug 2014 16:40:20 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270666 - head/sys/vm Message-ID: <201408261640.s7QGeKkw080562@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Tue Aug 26 16:40:20 2014 New Revision: 270666 URL: http://svnweb.freebsd.org/changeset/base/270666 Log: Back in the days when the kernel was single threaded, testing "vm_paging_target() > 0" was a reasonable way of determining if the inactive queue scan met its target. However, now that other threads can be allocating pages while the inactive queue scan is running, it's an unreliable method. The effect of it being unreliable is that we can start swapping out processes when we didn't intend to. This issue has existed since the kernel was multithreaded, but the changes to the inactive queue target in 10.0-RELEASE have made its effects visible. This change introduces a more direct method for determining if the inactive queue scan met its target that is not affected by the actions of other threads. Reported by: Steve Polyack Tested by: pho, Steve Polyack (an earlier version) MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Tue Aug 26 15:31:56 2014 (r270665) +++ head/sys/vm/vm_pageout.c Tue Aug 26 16:40:20 2014 (r270666) @@ -1299,6 +1299,23 @@ relock_queues: } vm_pagequeue_unlock(pq); +#if !defined(NO_SWAPPING) + /* + * Wakeup the swapout daemon if we didn't cache or free the targeted + * number of pages. + */ + if (vm_swap_enabled && page_shortage > 0) + vm_req_vmdaemon(VM_SWAP_NORMAL); +#endif + + /* + * Wakeup the sync daemon if we skipped a vnode in a writeable object + * and we didn't cache or free enough pages. + */ + if (vnodes_skipped > 0 && page_shortage > vm_cnt.v_free_target - + vm_cnt.v_free_min) + (void)speedup_syncer(); + /* * Compute the number of pages we want to try to move from the * active queue to the inactive queue. @@ -1408,20 +1425,6 @@ relock_queues: } } #endif - - /* - * If we didn't get enough free pages, and we have skipped a vnode - * in a writeable object, wakeup the sync daemon. And kick swapout - * if we did not get enough free pages. - */ - if (vm_paging_target() > 0) { - if (vnodes_skipped && vm_page_count_min()) - (void) speedup_syncer(); -#if !defined(NO_SWAPPING) - if (vm_swap_enabled && vm_page_count_target()) - vm_req_vmdaemon(VM_SWAP_NORMAL); -#endif - } /* * If we are critically low on one of RAM or swap and low on
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408261640.s7QGeKkw080562>