Re: useful LKM?

Andi Kleen (ak@muc.de)
02 Oct 1997 11:33:00 +0200


Jacques Gelinas <jack@solucorp.qc.ca> writes:

> Ultimatly, this optimisation could even be a compile time option
>
> [ ] Squeeze as much memory as need
>
> struct foo {
> .
> #if define(KERNEL_OPTION) || !defined(KERNEL_SQUEEZE)
> struct sub_foo *pt;
> #endif
> .
> };
Often is doesn't matter anyways, because the kmalloc() Linux uses always
rounds the block size to the next power of 2. Only when this additional
field causes the structure size to go into the next 'order' (e.g. from 32
to 64 bytes) it'll cost you memory. The kmalloc emulation on top of slab
in 2.1 is power-of-2 based too, if you use slap directly the effect is
still there (because slab aligns the objects in the page for the cache
colouring), but much less. Most structures in Linux are still managed
by kmalloc() though..

-Andi