Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/librump/rumpkern If RUMP_NCPU is set, use that for ...



details:   https://anonhg.NetBSD.org/src/rev/74f76b2f6b0b
branches:  trunk
changeset: 754341:74f76b2f6b0b
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Apr 28 11:34:18 2010 +0000

description:
If RUMP_NCPU is set, use that for virtual CPU count instead of
host CPU count.

diffstat:

 sys/rump/librump/rumpkern/rump.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 707e175ce701 -r 74f76b2f6b0b sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Wed Apr 28 09:55:25 2010 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Wed Apr 28 11:34:18 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.166 2010/04/28 00:43:16 pooka Exp $ */
+/*     $NetBSD: rump.c,v 1.167 2010/04/28 11:34:18 pooka Exp $ */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.166 2010/04/28 00:43:16 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.167 2010/04/28 11:34:18 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -219,10 +219,20 @@
                        boothowto = AB_VERBOSE;
        }
 
+       if (rumpuser_getenv("RUMP_NCPU", buf, sizeof(buf), &error) == 0)
+               error = 0;
        /* non-x86 is missing CPU_INFO_FOREACH() support */
 #if defined(__i386__) || defined(__x86_64__)
-       numcpu = rumpuser_getnhostcpu();
+       if (error == 0) {
+               numcpu = strtoll(buf, NULL, 10);
+               if (numcpu < 1)
+                       numcpu = 1;
+       } else {
+               numcpu = rumpuser_getnhostcpu();
+       }
 #else
+       if (error == 0)
+               printf("NCPU limited to 1 on this host\n");
        numcpu = 1;
 #endif
        rump_cpus_bootstrap(numcpu);



Home | Main Index | Thread Index | Old Index