From owner-svn-src-head@FreeBSD.ORG Sat Apr 11 09:09:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F318106566C; Sat, 11 Apr 2009 09:09:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 340618FC17; Sat, 11 Apr 2009 09:09:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3B991qu079763; Sat, 11 Apr 2009 09:09:01 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3B991N8079762; Sat, 11 Apr 2009 09:09:01 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200904110909.n3B991N8079762@svn.freebsd.org> From: Alan Cox Date: Sat, 11 Apr 2009 09:09:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190912 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Apr 2009 09:09:02 -0000 Author: alc Date: Sat Apr 11 09:09:00 2009 New Revision: 190912 URL: http://svn.freebsd.org/changeset/base/190912 Log: Previously, when vm_page_free_toq() was performed on a page belonging to a reservation, unless all of the reservation's pages were free, the reservation was moved to the head of the partially-populated reservations queue, where it would be the next reservation to be broken in case the free page queues were emptied. Now, instead, I am moving it to the tail. Very likely this reservation is in the process of being freed in its entirety, so placing it at the tail of the queue makes it more likely that the underlying physical memory will be returned to the free page queues as one contiguous chunk. If a reservation must be broken, it will, instead, be the longest unchanged reservation, which is arguably the reservation that is least likely to ever achieve promotion or be freed in its entirety. MFC after: 6 weeks Modified: head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Sat Apr 11 08:52:02 2009 (r190911) +++ head/sys/vm/vm_reserv.c Sat Apr 11 09:09:00 2009 (r190912) @@ -138,8 +138,8 @@ static vm_reserv_t vm_reserv_array; * The partially-populated reservation queue * * This queue enables the fast recovery of an unused cached or free small page - * from a partially-populated reservation. The head of this queue is either - * the least-recently-populated or most-recently-depopulated reservation. + * from a partially-populated reservation. The reservation at the head of + * this queue is the least-recently-changed, partially-populated reservation. * * Access to this queue is synchronized by the free page queue lock. */ @@ -209,7 +209,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER /* * Reduces the given reservation's population count. If the population count * becomes zero, the reservation is destroyed. Additionally, moves the - * reservation to the head of the partially-populated reservations queue if the + * reservation to the tail of the partially-populated reservations queue if the * population count is non-zero. * * The free page queue lock must be held. @@ -235,7 +235,7 @@ vm_reserv_depopulate(vm_reserv_t rv) vm_reserv_freed++; } else { rv->inpartpopq = TRUE; - TAILQ_INSERT_HEAD(&vm_rvq_partpop, rv, partpopq); + TAILQ_INSERT_TAIL(&vm_rvq_partpop, rv, partpopq); } }