Call the routine to calculate callwheelsize from allocsys() instead of

main() since some port like alpha and mips calls allocsys() before main()
is called.  While I'm here, I renamed some function.
This commit is contained in:
enami 2000-03-24 11:57:14 +00:00
parent 43e3ea96f3
commit f9c7a69ff5
4 changed files with 17 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.165 2000/03/23 06:30:07 thorpej Exp $ */ /* $NetBSD: init_main.c,v 1.166 2000/03/24 11:57:14 enami Exp $ */
/* /*
* Copyright (c) 1995 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1995 Christopher G. Demetriou. All rights reserved.
@ -207,14 +207,11 @@ main()
uvm_init(); uvm_init();
/* Initialize callouts. */
callout_startup();
/* Do machine-dependent initialization. */ /* Do machine-dependent initialization. */
cpu_startup(); cpu_startup();
/* Finish initializing callouts. */ /* Initialize callouts. */
callout_startup1(); callout_startup();
/* /*
* Initialize mbuf's. Do this now because we might attempt to * Initialize mbuf's. Do this now because we might attempt to

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_allocsys.c,v 1.9 2000/03/23 06:30:10 thorpej Exp $ */ /* $NetBSD: kern_allocsys.c,v 1.10 2000/03/24 11:57:15 enami Exp $ */
/*- /*-
* Copyright (c) 1999 The NetBSD Foundation, Inc. * Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -133,6 +133,10 @@ allocsys(v, mdcallback)
caddr_t (*mdcallback) __P((caddr_t)); caddr_t (*mdcallback) __P((caddr_t));
{ {
/* Calculate the number of callwheels if necessary. */
if (callwheelsize == 0)
callout_setsize();
ALLOCSYS(v, callwheel, struct callout_queue, callwheelsize); ALLOCSYS(v, callwheel, struct callout_queue, callwheelsize);
#ifdef CALLWHEEL_STATS #ifdef CALLWHEEL_STATS
ALLOCSYS(v, callwheel_sizes, int, callwheelsize); ALLOCSYS(v, callwheel_sizes, int, callwheelsize);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_clock.c,v 1.53 2000/03/23 20:51:09 thorpej Exp $ */ /* $NetBSD: kern_clock.c,v 1.54 2000/03/24 11:57:15 enami Exp $ */
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -860,15 +860,13 @@ softclock()
} }
/* /*
* callout_startup: * callout_setsize:
* *
* Initialize the callout subsystem. Called from main(). * Determine how many callwheels are necessary and
* * set hash mask. Called from allocsys().
* This must be called before cpu_startup(), which calls
* allocsys(), which is what actually allocates the callwheel.
*/ */
void void
callout_startup() callout_setsize()
{ {
for (callwheelsize = 1; callwheelsize < ncallout; callwheelsize <<= 1) for (callwheelsize = 1; callwheelsize < ncallout; callwheelsize <<= 1)
@ -877,12 +875,12 @@ callout_startup()
} }
/* /*
* callout_startup1: * callout_startup:
* *
* Initialize the callwheel buckets. * Initialize the callwheel buckets.
*/ */
void void
callout_startup1() callout_startup()
{ {
int i; int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: callout.h,v 1.13 2000/03/23 06:31:51 thorpej Exp $ */ /* $NetBSD: callout.h,v 1.14 2000/03/24 11:57:16 enami Exp $ */
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -105,8 +105,8 @@ extern int ncallout;
extern int *callwheel_sizes; /* for allocsys() */ extern int *callwheel_sizes; /* for allocsys() */
#endif #endif
void callout_setsize __P((void));
void callout_startup __P((void)); void callout_startup __P((void));
void callout_startup1 __P((void));
void callout_init __P((struct callout *)); void callout_init __P((struct callout *));
void callout_reset __P((struct callout *, int, void (*)(void *), void *)); void callout_reset __P((struct callout *, int, void (*)(void *), void *));
void callout_stop __P((struct callout *)); void callout_stop __P((struct callout *));