From 8f5a1742c25343d2387d822c06b25d1be67a34d4 Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Fri, 22 Jun 2001 16:03:23 +0000 Subject: [PATCH] Temporary fix at least- define NCPU_PRESENT which will be mp_npcus for SMP kernels, one (1) for non-SMP. --- sys/kern/subr_mbuf.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c index e2854848ff06..18efe4a9909b 100644 --- a/sys/kern/subr_mbuf.c +++ b/sys/kern/subr_mbuf.c @@ -56,6 +56,15 @@ #define NCPU MAXCPU #endif +/* + * SMP and non-SMP kernels clearly have a different number of possible cpus. + */ +#ifdef SMP +#define NCPU_PRESENT mp_ncpus +#else +#define NCPU_PRESENT 1 +#endif + /* * The mbuf allocator is heavily based on Alfred Perlstein's * (alfred@FreeBSD.org) "memcache" allocator which is itself based @@ -379,7 +388,7 @@ mb_init(void *dummy) /* * Allocate and initialize PCPU containers. */ - for (i = 0; i < mp_ncpus; i++) { + for (i = 0; i < NCPU_PRESENT; i++) { mb_list_mbuf.ml_cntlst[i] = malloc(sizeof(struct mb_pcpu_list), M_MBUF, M_NOWAIT); mb_list_clust.ml_cntlst[i] = malloc(sizeof(struct mb_pcpu_list), @@ -617,7 +626,7 @@ mb_alloc_wait(struct mb_lstmngr *mb_list) * Cycle all the PCPU containers. Increment starved counts if found * empty. */ - for (i = 0; i < mp_ncpus; i++) { + for (i = 0; i < NCPU_PRESENT; i++) { cnt_lst = MB_GET_PCPU_LIST_NUM(mb_list, i); MB_LOCK_CONT(cnt_lst);