summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2000-06-14 18:31:42 +0000
committerbde <bde@FreeBSD.org>2000-06-14 18:31:42 +0000
commit76169e6b33f628abbefe6799fd6a548c8747023b (patch)
treee2e23630a61ab3a1aedca42d0c2aa15fb599a31c /sys/kern/kern_malloc.c
parentcac2a38938bced86bc6133fd225bac8184017110 (diff)
downloadFreeBSD-src-76169e6b33f628abbefe6799fd6a548c8747023b.zip
FreeBSD-src-76169e6b33f628abbefe6799fd6a548c8747023b.tar.gz
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().
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 9568592..fe9459f 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);
OpenPOWER on IntegriCloud