diff options
author | Bruce Evans <bde@FreeBSD.org> | 2000-06-14 18:31:42 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 2000-06-14 18:31:42 +0000 |
commit | 8e8cac5555d1c7d2dd26d882361e010afc262bd8 (patch) | |
tree | 9a778f4b61e5887870c13ea0970e9e3ba05dea3a /sys/kern/kern_malloc.c | |
parent | 7c0bc50d70769a4dbf0194961f35d3c4c7f6a9de (diff) | |
download | src-8e8cac5555d1c7d2dd26d882361e010afc262bd8.tar.gz src-8e8cac5555d1c7d2dd26d882361e010afc262bd8.zip |
sys/malloc.h:
Order the SYSINIT() for MALLOC_DEFINE() correctly so that malloc()
doesn't have to waste time initializing itself. The
(SI_SUB_KMEM, SI_ORDER_ANY) order was shared with syscons' SYSINIT()
for scmeminit(), and scmeminit() calls malloc(), so malloc()
initialization was not always complete on the first call to malloc().
kern/kern_malloc.c:
- Removed self-initialization in malloc().
- Removed half-baked sanity check in free(). Trust MALLOC_DEFINE().
Notes
Notes:
svn path=/head/; revision=61689
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r-- | sys/kern/kern_malloc.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 95685925027c..fe9459f47692 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -147,19 +147,9 @@ malloc(size, type, flags) KASSERT(intr_nesting_level == 0, ("malloc(M_WAITOK) in interrupt context")); #endif - /* - * Must be at splmem() prior to initializing segment to handle - * potential initialization race. - */ - - s = splmem(); - - if (type->ks_limit == 0) - malloc_init(type); - indx = BUCKETINDX(size); kbp = &bucket[indx]; - + s = splmem(); while (ksp->ks_memuse >= ksp->ks_limit) { if (flags & M_ASLEEP) { if (ksp->ks_limblocks < 65535) @@ -298,9 +288,6 @@ free(addr, type) #endif register struct malloc_type *ksp = type; - if (type->ks_limit == 0) - panic("freeing with unknown type (%s)", type->ks_shortdesc); - KASSERT(kmembase <= (char *)addr && (char *)addr < kmemlimit, ("free: address %p out of range", (void *)addr)); kup = btokup(addr); |