From owner-svn-src-all@FreeBSD.ORG Tue Aug 26 16:40:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 479C7918; Tue, 26 Aug 2014 16:40:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 199D93A55; Tue, 26 Aug 2014 16:40:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7QGeK53080563; Tue, 26 Aug 2014 16:40:20 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7QGeKkw080562; Tue, 26 Aug 2014 16:40:20 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201408261640.s7QGeKkw080562@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 26 Aug 2014 16:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270666 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Aug 2014 16:40:21 -0000 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