Panic if UMA_ZONE_PCPU is created at early stages of boot, when mp_ncpus
isn't yet initialized. Otherwise we will panic at first allocation later. Sponsored by: Nginx, Inc.
This commit is contained in:
parent
3594d490ac
commit
18dd370b59
@ -1139,6 +1139,7 @@ keg_small_init(uma_keg_t keg)
|
|||||||
u_int shsize;
|
u_int shsize;
|
||||||
|
|
||||||
if (keg->uk_flags & UMA_ZONE_PCPU) {
|
if (keg->uk_flags & UMA_ZONE_PCPU) {
|
||||||
|
KASSERT(mp_ncpus > 0, ("%s: ncpus %d\n", __func__, mp_ncpus));
|
||||||
keg->uk_slabsize = sizeof(struct pcpu);
|
keg->uk_slabsize = sizeof(struct pcpu);
|
||||||
keg->uk_ppera = howmany(mp_ncpus * sizeof(struct pcpu),
|
keg->uk_ppera = howmany(mp_ncpus * sizeof(struct pcpu),
|
||||||
PAGE_SIZE);
|
PAGE_SIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user