From owner-svn-src-head@freebsd.org Sat Sep 5 17:34:50 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86AE29CAE55; Sat, 5 Sep 2015 17:34:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.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 6623212C0; Sat, 5 Sep 2015 17:34:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t85HYoaY068100; Sat, 5 Sep 2015 17:34:50 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t85HYoQ9068099; Sat, 5 Sep 2015 17:34:50 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509051734.t85HYoQ9068099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 5 Sep 2015 17:34:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287488 - 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-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Sep 2015 17:34:50 -0000 Author: alc Date: Sat Sep 5 17:34:49 2015 New Revision: 287488 URL: https://svnweb.freebsd.org/changeset/base/287488 Log: Eliminate pointless requeueing of pages from terminated objects. These pages will have left the inactive queue before the page daemon performs its next scan. Also, ignore references to pages from terminated objects. This allows the clean pages to be freed a little sooner. Move some comments to their proper place, i.e., next to the code that they describe, and update other nearby comments. Reviewed by: kib 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 Sat Sep 5 17:29:07 2015 (r287487) +++ head/sys/vm/vm_pageout.c Sat Sep 5 17:34:49 2015 (r287488) @@ -1186,13 +1186,9 @@ unlock_page: } /* - * We bump the activation count if the page has been - * referenced while in the inactive queue. This makes - * it less likely that the page will be added back to the - * inactive queue prematurely again. Here we check the - * page tables (or emulated bits, if any), given the upper - * level VM system not knowing anything about existing - * references. + * If the page has been referenced and the object is not dead, + * reactivate or requeue the page depending on whether the + * object is mapped. */ if ((m->aflags & PGA_REFERENCED) != 0) { vm_page_aflag_clear(m, PGA_REFERENCED); @@ -1205,21 +1201,25 @@ unlock_page: KASSERT(!pmap_page_is_mapped(m), ("vm_pageout_scan: page %p is mapped", m)); } - - /* - * If the upper level VM system knows about any page - * references, we reactivate the page or requeue it. - */ if (act_delta != 0) { if (object->ref_count != 0) { vm_page_activate(m); + + /* + * Increase the activation count if the page + * was referenced while in the inactive queue. + * This makes it less likely that the page will + * be returned prematurely to the inactive + * queue. + */ m->act_count += act_delta + ACT_ADVANCE; - } else { + goto drop_page; + } else if ((object->flags & OBJ_DEAD) == 0) { vm_pagequeue_lock(pq); queues_locked = TRUE; vm_page_requeue_locked(m); + goto drop_page; } - goto drop_page; } /* @@ -1243,6 +1243,15 @@ unlock_page: vm_page_free(m); PCPU_INC(cnt.v_dfree); --page_shortage; + } else if ((object->flags & OBJ_DEAD) != 0) { + /* + * Leave dirty pages from dead objects at the front of + * the queue. They are being paged out and freed by + * the thread that destroyed the object. They will + * leave the queue shortly after the scan finishes, so + * they should be discounted from the inactive count. + */ + addl_page_shortage++; } else if ((m->flags & PG_WINATCFLS) == 0 && pass < 2) { /* * Dirty pages need to be paged out, but flushing @@ -1278,18 +1287,11 @@ unlock_page: pageout_ok = vm_page_count_min(); else pageout_ok = TRUE; - - /* - * We don't bother paging objects that are "dead". - * Those objects are in a "rundown" state. - */ - if (!pageout_ok || (object->flags & OBJ_DEAD) != 0) { + if (!pageout_ok) { vm_pagequeue_lock(pq); - vm_page_unlock(m); - VM_OBJECT_WUNLOCK(object); queues_locked = TRUE; vm_page_requeue_locked(m); - goto relock_queues; + goto drop_page; } error = vm_pageout_clean(m); /*