From owner-svn-src-all@FreeBSD.ORG Thu Mar 6 18:50:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCC351D3; Thu, 6 Mar 2014 18:50:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BD6D8BC3; Thu, 6 Mar 2014 18:50:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s26IoZRo044869; Thu, 6 Mar 2014 18:50:35 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s26IoZx0044866; Thu, 6 Mar 2014 18:50:35 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201403061850.s26IoZx0044866@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Thu, 6 Mar 2014 18:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r262863 - in stable/9/sys: kern vm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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, 06 Mar 2014 18:50:36 -0000 Author: dumbbell Date: Thu Mar 6 18:50:35 2014 New Revision: 262863 URL: http://svnweb.freebsd.org/changeset/base/262863 Log: MFC r226824: contigmalloc(9) and contigfree(9) are now implemented in terms of other more general VM system interfaces. So, their implementation can now reside in kern_malloc.c alongside the other functions that are declared in malloc.h. Modified: stable/9/sys/kern/kern_malloc.c stable/9/sys/vm/vm_contig.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_malloc.c ============================================================================== --- stable/9/sys/kern/kern_malloc.c Thu Mar 6 18:48:02 2014 (r262862) +++ stable/9/sys/kern/kern_malloc.c Thu Mar 6 18:50:35 2014 (r262863) @@ -406,6 +406,43 @@ malloc_type_freed(struct malloc_type *mt } /* + * contigmalloc: + * + * Allocate a block of physically contiguous memory. + * + * If M_NOWAIT is set, this routine will not block and return NULL if + * the allocation fails. + */ +void * +contigmalloc(unsigned long size, struct malloc_type *type, int flags, + vm_paddr_t low, vm_paddr_t high, unsigned long alignment, + unsigned long boundary) +{ + void *ret; + + ret = (void *)kmem_alloc_contig(kernel_map, size, flags, low, high, + alignment, boundary, VM_MEMATTR_DEFAULT); + if (ret != NULL) + malloc_type_allocated(type, round_page(size)); + return (ret); +} + +/* + * contigfree: + * + * Free a block of memory allocated by contigmalloc. + * + * This routine may not block. + */ +void +contigfree(void *addr, unsigned long size, struct malloc_type *type) +{ + + kmem_free(kernel_map, (vm_offset_t)addr, size); + malloc_type_freed(type, round_page(size)); +} + +/* * malloc: * * Allocate a block of memory. Modified: stable/9/sys/vm/vm_contig.c ============================================================================== --- stable/9/sys/vm/vm_contig.c Thu Mar 6 18:48:02 2014 (r262862) +++ stable/9/sys/vm/vm_contig.c Thu Mar 6 18:50:35 2014 (r262863) @@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -359,25 +358,6 @@ contigmapping(vm_map_t map, vm_size_t si return (addr); } -void * -contigmalloc( - unsigned long size, /* should be size_t here and for malloc() */ - struct malloc_type *type, - int flags, - vm_paddr_t low, - vm_paddr_t high, - unsigned long alignment, - unsigned long boundary) -{ - void *ret; - - ret = (void *)kmem_alloc_contig(kernel_map, size, flags, low, high, - alignment, boundary, VM_MEMATTR_DEFAULT); - if (ret != NULL) - malloc_type_allocated(type, round_page(size)); - return (ret); -} - vm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, unsigned long boundary, @@ -407,11 +387,3 @@ retry: } return (ret); } - -void -contigfree(void *addr, unsigned long size, struct malloc_type *type) -{ - - kmem_free(kernel_map, (vm_offset_t)addr, size); - malloc_type_freed(type, round_page(size)); -}