kmalloc before kmem_cache_init

Sukanto Ghosh sukanto.cse.iitb at gmail.com
Sun Jan 29 01:02:33 EST 2012


I am kind of lost trying to figure out how can kmallocs work if they
are called before kmem_cache_init

(e.g. such a case occurs when in start_kernel() we call
parse_early_param() (which in turn might call
early_serial8250_setup() if earlycon= is used in kernel command-line)
before mm_init()  (which later calls
kmem_cache_init() )

>From what I understood, kmalloc() (SLUB implementation) first tries to
find out the slab fit for the size
being kmalloced and slabs are nothing but kmalloc_caches[]. Now these
kmalloc_caches get initialized in
kmem_cache_init().

What am I missing here ?

Regards,
Sukanto Ghosh


-- 
Regards,
Sukanto Ghosh



More information about the Kernelnewbies mailing list