Subject: Re: FREE( s, M_xxxx ) - a bug you don't want to look for!
To: David Laight <david@l8s.co.uk>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 06/27/2002 10:11:03
On Thu, Jun 27, 2002 at 05:11:08PM +0100, David Laight wrote:

 > If you could 'assert' it you could force a call to malloc() instead.

The whole point of using a constant size in this case is for the
compiler to do constant folding.  Take a look at the macros involved.
If you don't use a compile-time constant, it's evaluated at run-time,
with the associated explosion in code size.

 > I have my doubts as to how much these macros save?
 > Maybe I'll time a kernel build with them on/off.

If you use DIAGNOSTIC, they're already off.

 > I also suspect that replacing all the 'pool' allocates with
 > (a slightly modified) malloc() would be benefitial.

Huh?  We specifically switched from malloc to pool in many places because
the pool allocator is more memory-efficient, and can also allocate KVA from
different VM maps (thus reducing the pressure on malloc's kmem_map).

(pools also allow you to take advantage of direct-mapped segments, like
KSEG0 on MIPS/Alpha, thus greatly reducing TLB usage on those platforms.)

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>