Module Name:    src
Committed By:   pooka
Date:           Fri Jul 20 09:20:05 UTC 2012

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

Log Message:
Make it possible to select between real and unreal allocators from
make.  Plus some gratuitous renaming.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r1.17 -r1.18 src/sys/rump/librump/rumpkern/memalloc.c
cvs rdiff -u -r1.128 -r1.129 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.118 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.119
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.118	Fri Jun 22 12:45:43 2012
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Fri Jul 20 09:20:05 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.118 2012/06/22 12:45:43 rmind Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.119 2012/07/20 09:20:05 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -128,13 +128,16 @@ SRCS+=	clock_subr.c
 # compat
 SRCS+=	kern_select_50.c
 
-# Flip the comment to the other line if you want to use malloc(3)
-# directly instead of the kernel allocators backed by malloc(3)/mmap(2).
-# Libc malloc is a few percent faster, but doesn't emulate all kernel
-# corner cases as well (not to mention if you want to debug the
+# Set RUMP_UNREAL_ALLOCATORS to "yes" to use memory allocation hypercalls
+# directly instead of the kmem/pool allocators backed by hypercalls.
+# Direct hypercalls may be a few percent faster, but don't emulate
+# all kernel corner cases as well (not to mention if you want to debug the
 # allocators themselves).
-#CPPFLAGS+=	-DRUMP_USE_UNREAL_ALLOCATORS
+.if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
+CPPFLAGS+=	-DRUMP_UNREAL_ALLOCATORS
+.else
 SRCS+=		subr_kmem.c subr_percpu.c subr_pool.c subr_vmem.c
+.endif
 
 .ifdef RUMP_LOCKDEBUG
 SRCS+=		subr_lockdebug.c

Index: src/sys/rump/librump/rumpkern/memalloc.c
diff -u src/sys/rump/librump/rumpkern/memalloc.c:1.17 src/sys/rump/librump/rumpkern/memalloc.c:1.18
--- src/sys/rump/librump/rumpkern/memalloc.c:1.17	Fri Jul 20 09:11:33 2012
+++ src/sys/rump/librump/rumpkern/memalloc.c	Fri Jul 20 09:20:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: memalloc.c,v 1.17 2012/07/20 09:11:33 pooka Exp $	*/
+/*	$NetBSD: memalloc.c,v 1.18 2012/07/20 09:20:05 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.17 2012/07/20 09:11:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.18 2012/07/20 09:20:05 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -88,7 +88,7 @@ kern_free(void *ptr)
  * Kmem
  */
 
-#ifdef RUMP_USE_UNREAL_ALLOCATORS
+#ifdef RUMP_UNREAL_ALLOCATORS
 void
 kmem_init()
 {
@@ -391,4 +391,4 @@ percpu_foreach(percpu_t *pc, percpu_call
 
 	cb(pc, arg, rump_cpu);
 }
-#endif /* RUMP_USE_UNREAL_ALLOCATORS */
+#endif /* RUMP_UNREAL_ALLOCATORS */

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.128 src/sys/rump/librump/rumpkern/vm.c:1.129
--- src/sys/rump/librump/rumpkern/vm.c:1.128	Fri Jul 20 09:11:33 2012
+++ src/sys/rump/librump/rumpkern/vm.c	Fri Jul 20 09:20:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.128 2012/07/20 09:11:33 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.129 2012/07/20 09:20:05 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.128 2012/07/20 09:11:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.129 2012/07/20 09:20:05 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -332,7 +332,7 @@ uvm_init(void)
 
 	pool_subsystem_init();
 
-#ifndef RUMP_USE_UNREAL_ALLOCATORS
+#ifndef RUMP_UNREAL_ALLOCATORS
 	vmem_bootstrap();
 	kmem_arena = vmem_create("kmem", 0, 1024*1024, PAGE_SIZE,
 	    NULL, NULL, NULL,
@@ -343,7 +343,7 @@ 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_USE_UNREAL_ALLOCATORS */
+#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