Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Aug 1995 19:18:10 -0700
From:      David Greenman <davidg@Root.COM>
To:        terry@cs.weber.edu (Terry Lambert)
Cc:        hackers@freebsd.org
Subject:   Re: sys/malloc.h 
Message-ID:  <199508250218.TAA13550@corbin.Root.COM>
In-Reply-To: Your message of "Thu, 24 Aug 95 20:09:44 MDT." <9508250209.AA09902@cs.weber.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
>>    The KMEMSTATS #ifdefs are bogus and should be removed. I had removed them
>> once in my local sources but the changes got lost. We always gather malloc
>> stats in FreeBSD - the information is just too important to be without.
>
>In which case the MALLOC()/free() parings are incorrect, and should be
>using MALLOC()/FREE() instead, right?  Or malloc()/free().
>
>It doesn't seem legal to mix pairings.

   MALLOC/FREE are bogus and should be removed.

>On the other hand, the spl() code still seems ...bizarre.  The spl() is
>being set twice, once in the malloc()/free() and once on the macroized
>versions.

   The stats are collected in malloc/free, not in the macroized versions.

>Seems that maybe the stats gathering should be moved into malloc()/free()
>itself instead of being in malloc.h to save at least one spl/splx pair.

   The extra spls are never executed since KMEMSTATS is always true.

>We may even want to reconsider why spl/splx is needed to guard around
>the malloc()/free() anyway -- obviously to allow allocation/freeing
>in interrupt code.  Perhaps we should adopt an architecture of prealloc
>and free later for interrupt level alloc/free?

   It's because mallocs and frees have to happen in the networking code at
interrupt time. It would be tremendously wasteful to pre-alloc megabytes of
memory just to avoid this.

-DG



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508250218.TAA13550>