kernel malloc() and free()

Shrivatsan shrivatsan_v at yahoo.com
Mon Mar 1 23:47:26 UTC 2010


Hi,

I am looking at the code that allocates and frees kernel memory. I 
understand that allocating kernel memory is quite different from 
the user level mallocs. In case of user level mallocs, we allocate 
requested size + 4 bytes and store the requested size in the 
additional 4 bytes. 

However, in the case of kernel, allocating an additional 4 bytes is 
a overhead since the request might fall in the next bucket. I looked 
into the code and the documentation in the file uma_int.h, but I 
don't quite understand the relation between slabs, zones and keg.
How do we determine the size of the memory that we are trying to
free from given the virtual address? 

Thanks in advance for the help.
-shrivatsan


      


More information about the freebsd-hackers mailing list