<br><br><div class="gmail_quote">On Fri, Mar 15, 2013 at 6:08 PM, ishare <span dir="ltr"><<a href="mailto:june.tune.sea@gmail.com" target="_blank">june.tune.sea@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Fri, Mar 15, 2013 at 11:39:07AM +0530, Prabhu nath wrote:<br>
> kmem_cache_init() will create generalized caches from where kmalloc() will<br>
> allocate memory.<br>
><br>
> vfs_caches_init() will create specialized caches related to VFS, like,<br>
> dentry, inode_cache, mnt_cache....<br>
<br>
</div> what is the relation between cache_cache and these two functions?<br>
is there clue for understanding this?<br></blockquote><div><br> Slab cache creation either for specialized cache or generalized cache is done through kmem_cache_alloc(). <br> kmem_cache_init() is a wrapper function which will create generalized caches again using kmem_cache_alloc()<br>
vfs_caches_init() is a wrapper function which will create specialized caches required by VFS sub-system, again using kmem_cache_alloc(). <br><br> there is a slab cache named "kmem_cache"of size "struct kmem_cache"used to allocate memory objects for slab cache descriptor "kmem_cache". Now this slab cache will also have one descriptor. Where will you allocate memory for this descriptor ?<br>
<br>The answer is - this will be allocated statically as struct kmem_cache cache_cache.<br><br>I have attached a brief notes on "Slab Allocator" in a separate mail. Kindly read it. Also to get more clarity read memory management chapters in the following books. <br>
"The Linux Kernel Primer " - Claudia Rodriguez, Gordon Fischer & Steven Smolski<br>"ULK" - Daniel P Bovet. <br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
thanks!<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
><br>
> Regards,<br>
> Prabhunath G<br>
> Linux Trainer<br>
> Bangalore<br>
><br>
> On Fri, Mar 15, 2013 at 10:08 AM, ishare <<a href="mailto:june.tune.sea@gmail.com">june.tune.sea@gmail.com</a>> wrote:<br>
><br>
> ><br>
> > the function kmem_cache_init() is allocating which area for whom to use ?<br>
> ><br>
> > what is the difference comparing with vfs_caches_init() ?<br>
> ><br>
> > thanks!<br>
> ><br>
> > _______________________________________________<br>
> > Kernelnewbies mailing list<br>
> > <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> > <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
> ><br>
><br>
><br>
><br>
> --<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Prabhunath G<br>Linux Trainer<br>Bangalore<br>