Module Name:    src
Committed By:   pooka
Date:           Sun Mar 10 17:05:12 UTC 2013

Modified Files:
        src/sys/rump/librump/rumpkern: Makefile.rumpkern memalloc.c rump.c vm.c

Log Message:
Use kern_malloc.c instead of the relegated allocators in memalloc.c.
Previously this didn't make sense due to the use of kmem_map, but the
new malloc is more dynamic and puts sense into using it.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r1.19 -r1.20 src/sys/rump/librump/rumpkern/memalloc.c
cvs rdiff -u -r1.256 -r1.257 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.136 -r1.137 src/sys/rump/librump/rumpkern/vm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.122 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.123
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.122	Sun Mar 10 16:27:11 2013
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Sun Mar 10 17:05:12 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.122 2013/03/10 16:27:11 pooka Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.123 2013/03/10 17:05:12 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -20,7 +20,7 @@ LIB=		rump
 # Source modules, first the ones specifically implemented for librump.
 # 
 SRCS=	rump.c rumpcopy.c emul.c intr.c lwproc.c klock.c	\
-	kobj_rename.c ltsleep.c memalloc.c scheduler.c		\
+	kobj_rename.c ltsleep.c scheduler.c			\
 	signals.c sleepq.c threads.c vm.c cprng_stub.c
 
 # Multiprocessor or uniprocessor locking.  TODO: select right
@@ -137,9 +137,9 @@ SRCS+=	kern_select_50.c
 # all kernel corner cases as well (not to mention if you want to debug the
 # allocators themselves).
 .if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
-CPPFLAGS+=	-DRUMP_UNREAL_ALLOCATORS
+SRCS+=		memalloc.c
 .else
-SRCS+=		subr_kmem.c subr_pool.c
+SRCS+=		kern_malloc.c subr_kmem.c subr_pool.c
 .endif
 
 .ifdef RUMP_LOCKDEBUG

Index: src/sys/rump/librump/rumpkern/memalloc.c
diff -u src/sys/rump/librump/rumpkern/memalloc.c:1.19 src/sys/rump/librump/rumpkern/memalloc.c:1.20
--- src/sys/rump/librump/rumpkern/memalloc.c:1.19	Sun Mar 10 16:27:11 2013
+++ src/sys/rump/librump/rumpkern/memalloc.c	Sun Mar 10 17:05:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: memalloc.c,v 1.19 2013/03/10 16:27:11 pooka Exp $	*/
+/*	$NetBSD: memalloc.c,v 1.20 2013/03/10 17:05:12 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,13 +26,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.19 2013/03/10 16:27:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.20 2013/03/10 17:05:12 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
 #include <sys/malloc.h>
 #include <sys/pool.h>
 
+#include <uvm/uvm_extern.h>
+
 #include <rump/rumpuser.h>
 
 #include "rump_private.h"
@@ -52,6 +54,13 @@ __KERNEL_RCSID(0, "$NetBSD: memalloc.c,v
  * malloc
  */
 
+void
+kmeminit(void)
+{
+
+	return;
+}
+
 void *
 kern_malloc(unsigned long size, int flags)
 {
@@ -86,7 +95,6 @@ kern_free(void *ptr)
  * Kmem
  */
 
-#ifdef RUMP_UNREAL_ALLOCATORS
 void
 kmem_init()
 {
@@ -325,5 +333,3 @@ struct pool_allocator pool_allocator_kme
         .pa_free = pool_page_free,
         .pa_pagesz = 0
 };
-
-#endif /* RUMP_UNREAL_ALLOCATORS */

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.256 src/sys/rump/librump/rumpkern/rump.c:1.257
--- src/sys/rump/librump/rumpkern/rump.c:1.256	Sun Mar 10 16:51:31 2013
+++ src/sys/rump/librump/rumpkern/rump.c	Sun Mar 10 17:05:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.256 2013/03/10 16:51:31 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.257 2013/03/10 17:05:12 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.256 2013/03/10 16:51:31 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.257 2013/03/10 17:05:12 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -309,6 +309,7 @@ rump__init(int rump_version)
 	prop_kern_init();
 
 	kmem_init();
+	kmeminit();
 
 	uvm_ra_init();
 	uao_init();

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.136 src/sys/rump/librump/rumpkern/vm.c:1.137
--- src/sys/rump/librump/rumpkern/vm.c:1.136	Wed Mar  6 11:42:18 2013
+++ src/sys/rump/librump/rumpkern/vm.c	Sun Mar 10 17:05:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.136 2013/03/06 11:42:18 yamt Exp $	*/
+/*	$NetBSD: vm.c,v 1.137 2013/03/10 17:05:12 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.136 2013/03/06 11:42:18 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.137 2013/03/10 17:05:12 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -349,7 +349,6 @@ uvm_init(void)
 
 	pool_subsystem_init();
 
-#ifndef RUMP_UNREAL_ALLOCATORS
 	kmem_arena = vmem_create("kmem", 0, 1024*1024, PAGE_SIZE,
 	    NULL, NULL, NULL,
 	    0, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM);
@@ -359,7 +358,6 @@ uvm_init(void)
 	kmem_va_arena = vmem_create("kva", 0, 0, PAGE_SIZE,
 	    vmem_alloc, vmem_free, kmem_arena,
 	    8 * PAGE_SIZE, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM);
-#endif /* !RUMP_UNREAL_ALLOCATORS */
 
 	pool_cache_bootstrap(&pagecache, sizeof(struct vm_page), 0, 0, 0,
 	    "page$", NULL, IPL_NONE, pgctor, pgdtor, NULL);

Reply via email to