From owner-svn-src-head@FreeBSD.ORG Fri Nov 4 04:41:58 2011 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 DB076106566C; Fri, 4 Nov 2011 04:41:58 +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 CB71B8FC08; Fri, 4 Nov 2011 04:41:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA44fwtX001671; Fri, 4 Nov 2011 04:41:58 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA44fwGc001669; Fri, 4 Nov 2011 04:41:58 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201111040441.pA44fwGc001669@svn.freebsd.org> From: Alan Cox Date: Fri, 4 Nov 2011 04:41:58 +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: r227072 - 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: Fri, 04 Nov 2011 04:41:59 -0000 Author: alc Date: Fri Nov 4 04:41:58 2011 New Revision: 227072 URL: http://svn.freebsd.org/changeset/base/227072 Log: Simplify the implementation of the failure case in kmem_alloc_attr(). Modified: head/sys/vm/vm_contig.c Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Fri Nov 4 04:06:31 2011 (r227071) +++ head/sys/vm/vm_contig.c Fri Nov 4 04:41:58 2011 (r227072) @@ -258,8 +258,8 @@ kmem_alloc_attr(vm_map_t map, vm_size_t retry: m = vm_phys_alloc_contig(1, low, high, PAGE_SIZE, 0); if (m == NULL) { + VM_OBJECT_UNLOCK(object); if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { - VM_OBJECT_UNLOCK(object); vm_map_unlock(map); vm_contig_grow_cache(tries, low, high); vm_map_lock(map); @@ -267,13 +267,12 @@ retry: tries++; goto retry; } - while (i != 0) { - i -= PAGE_SIZE; - m = vm_page_lookup(object, OFF_TO_IDX(offset + - i)); - vm_page_free(m); - } - VM_OBJECT_UNLOCK(object); + /* + * Since the pages that were allocated by any previous + * iterations of this loop are not busy, they can be + * freed by vm_object_page_remove(), which is called + * by vm_map_delete(). + */ vm_map_delete(map, addr, addr + size); vm_map_unlock(map); return (0);