From owner-svn-src-all@FreeBSD.ORG Thu Jul 8 08:37:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F5E9106564A; Thu, 8 Jul 2010 08:37:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 579158FC1C; Thu, 8 Jul 2010 08:37:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o688bpXY057889; Thu, 8 Jul 2010 08:37:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o688bpAw057886; Thu, 8 Jul 2010 08:37:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201007080837.o688bpAw057886@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 8 Jul 2010 08:37:51 +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: r209792 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 08 Jul 2010 08:37:51 -0000 Author: kib Date: Thu Jul 8 08:37:51 2010 New Revision: 209792 URL: http://svn.freebsd.org/changeset/base/209792 Log: Make VM_ALLOC_RETRY flag mandatory for vm_page_grab(). Assert that the flag is always provided, and unconditionally retry after sleep for the busy page or failed allocation. The intent is to remove VM_ALLOC_RETRY eventually. Proposed and reviewed by: alc Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Jul 8 04:04:27 2010 (r209791) +++ head/sys/vm/vm_page.c Thu Jul 8 08:37:51 2010 (r209792) @@ -2032,6 +2032,9 @@ vm_page_dontneed(vm_page_t m) * to be in the object. If the page doesn't exist, first allocate it * and then conditionally zero it. * + * The caller must always specify the VM_ALLOC_RETRY flag. This is intended + * to facilitate its eventual removal. + * * This routine may block. */ vm_page_t @@ -2041,22 +2044,20 @@ vm_page_grab(vm_object_t object, vm_pind u_int count; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + KASSERT((allocflags & VM_ALLOC_RETRY) != 0, + ("vm_page_grab: VM_ALLOC_RETRY is required")); retrylookup: if ((m = vm_page_lookup(object, pindex)) != NULL) { if ((m->oflags & VPO_BUSY) != 0 || ((allocflags & VM_ALLOC_IGN_SBUSY) == 0 && m->busy != 0)) { - if ((allocflags & VM_ALLOC_RETRY) != 0) { - /* - * Reference the page before unlocking and - * sleeping so that the page daemon is less - * likely to reclaim it. - */ - vm_page_lock_queues(); - vm_page_flag_set(m, PG_REFERENCED); - } + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); vm_page_sleep(m, "pgrbwt"); - if ((allocflags & VM_ALLOC_RETRY) == 0) - return (NULL); goto retrylookup; } else { if ((allocflags & VM_ALLOC_WIRED) != 0) { @@ -2078,8 +2079,6 @@ retrylookup: atomic_add_int(&vm_pageout_deficit, count); VM_WAIT; VM_OBJECT_LOCK(object); - if ((allocflags & VM_ALLOC_RETRY) == 0) - return (NULL); goto retrylookup; } else if (m->valid != 0) return (m); Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Thu Jul 8 04:04:27 2010 (r209791) +++ head/sys/vm/vm_page.h Thu Jul 8 08:37:51 2010 (r209792) @@ -312,7 +312,7 @@ extern struct vpglocks vm_page_queue_loc /* page allocation flags: */ #define VM_ALLOC_WIRED 0x0020 /* non pageable */ #define VM_ALLOC_ZERO 0x0040 /* Try to obtain a zeroed page */ -#define VM_ALLOC_RETRY 0x0080 /* vm_page_grab() only */ +#define VM_ALLOC_RETRY 0x0080 /* Mandatory with vm_page_grab() */ #define VM_ALLOC_NOOBJ 0x0100 /* No associated object */ #define VM_ALLOC_NOBUSY 0x0200 /* Do not busy the page */ #define VM_ALLOC_IFCACHED 0x0400 /* Fail if the page is not cached */