malloc() in kernel and increasing mbuf and cluster size

kamal kc kamal_ckk at yahoo.com
Mon Oct 17 04:49:02 PDT 2005


this may be a trivial question for many of you
but i am confused in doing memory allocation in the 
kernel.

sys/malloc.h has function prototypes for malloc()
kern/kern_malloc.c defines the malloc()

the malloc() definition is

void *
malloc(size, type, flags)
	unsigned long size;
	struct malloc_type *type;
	int flags;

i understand the size and flags but what shall i 
do with the malloc_type.

suppose i want to allocate 1024 bytes then how 
should i call the malloc ?

i set -->
    size=1024
    flags=M_WAITOK
     type=???? (i don't know what/how to initialize
              the type) 


Next thing is that i want to make the kernel process 
network packets very fast. 
i think of increasing the mbuf and cluster size.

i want to if there will be any effect on increasing 
the mbuf and cluster size.

what would be an appropriate size of mbuf and cluster
if I use 
 i. 512 MB RAM
 iI. 1024 MB RAM
 
which parts of the kernel will be affected by 
changing the mbuf and cluster size ?

i think somebody maybe able to help me.

thanks folks.
kamal 











		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/


More information about the freebsd-hackers mailing list