percpu_init() should be called before cpu_configure() if we want to use
per-CPU memory allocation in drivers.

I placed it early, right before mbinit() because it is only initializing
a memory pool and we should allow other subsystems to rely on it.

Ok?

Index: kern/init_main.c
===================================================================
RCS file: /cvs/src/sys/kern/init_main.c,v
retrieving revision 1.296
diff -u -p -r1.296 init_main.c
--- kern/init_main.c    25 Feb 2020 16:55:33 -0000      1.296
+++ kern/init_main.c    3 Mar 2020 10:50:44 -0000
@@ -236,6 +236,9 @@ main(void *framep)
 
        random_start();         /* Start the flow */
 
+       /* Per CPU memory allocation */
+       percpu_init();
+
        /*
         * Initialize mbuf's.  Do this now because we might attempt to
         * allocate mbufs or mbuf clusters during autoconfiguration.
@@ -368,9 +371,6 @@ main(void *framep)
 
        /* Configure virtual memory system, set vm rlimits. */
        uvm_init_limits(&limit0);
-
-       /* Per CPU memory allocation */
-       percpu_init();
 
        /* Initialize the file systems. */
 #if defined(NFSSERVER) || defined(NFSCLIENT)

Reply via email to