From owner-svn-src-stable-9@FreeBSD.ORG Thu May 24 04:33:32 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D13BC106566B; Thu, 24 May 2012 04:33:32 +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 A269A8FC0C; Thu, 24 May 2012 04:33:32 +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 q4O4XWU0015498; Thu, 24 May 2012 04:33:32 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4O4XWKT015496; Thu, 24 May 2012 04:33:32 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201205240433.q4O4XWKT015496@svn.freebsd.org> From: Alan Cox Date: Thu, 24 May 2012 04:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235882 - stable/9/sys/vm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 04:33:32 -0000 Author: alc Date: Thu May 24 04:33:32 2012 New Revision: 235882 URL: http://svn.freebsd.org/changeset/base/235882 Log: MFC r232288 Simplify kmem_alloc() by eliminating code that existed on account of external pagers in Mach. Modified: stable/9/sys/vm/vm_kern.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_kern.c ============================================================================== --- stable/9/sys/vm/vm_kern.c Thu May 24 04:24:17 2012 (r235881) +++ stable/9/sys/vm/vm_kern.c Thu May 24 04:33:32 2012 (r235882) @@ -161,7 +161,6 @@ kmem_alloc(map, size) { vm_offset_t addr; vm_offset_t offset; - vm_offset_t i; size = round_page(size); @@ -187,35 +186,6 @@ kmem_alloc(map, size) vm_map_unlock(map); /* - * Guarantee that there are pages already in this object before - * calling vm_map_wire. This is to prevent the following - * scenario: - * - * 1) Threads have swapped out, so that there is a pager for the - * kernel_object. 2) The kmsg zone is empty, and so we are - * kmem_allocing a new page for it. 3) vm_map_wire calls vm_fault; - * there is no page, but there is a pager, so we call - * pager_data_request. But the kmsg zone is empty, so we must - * kmem_alloc. 4) goto 1 5) Even if the kmsg zone is not empty: when - * we get the data back from the pager, it will be (very stale) - * non-zero data. kmem_alloc is defined to return zero-filled memory. - * - * We're intentionally not activating the pages we allocate to prevent a - * race with page-out. vm_map_wire will wire the pages. - */ - VM_OBJECT_LOCK(kernel_object); - for (i = 0; i < size; i += PAGE_SIZE) { - vm_page_t mem; - - mem = vm_page_grab(kernel_object, OFF_TO_IDX(offset + i), - VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_RETRY); - mem->valid = VM_PAGE_BITS_ALL; - KASSERT((mem->oflags & VPO_UNMANAGED) != 0, - ("kmem_alloc: page %p is managed", mem)); - } - VM_OBJECT_UNLOCK(kernel_object); - - /* * And finally, mark the data as non-pageable. */ (void) vm_map_wire(map, addr, addr + size,