On Fri, Mar 15, 2013 at 6:08 PM, ishare <june.tune.sea@xxxxxxxxx> wrote:
Slab cache creation either for specialized cache or generalized cache is done through kmem_cache_alloc().
kmem_cache_init() is a wrapper function which will create generalized caches again using kmem_cache_alloc()
vfs_caches_init() is a wrapper function which will create specialized caches required by VFS sub-system, again using kmem_cache_alloc().
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 ?
The answer is - this will be allocated statically as struct kmem_cache cache_cache.
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.
"The Linux Kernel Primer " - Claudia Rodriguez, Gordon Fischer & Steven Smolski
"ULK" - Daniel P Bovet.
On Fri, Mar 15, 2013 at 11:39:07AM +0530, Prabhu nath wrote:what is the relation between cache_cache and these two functions?
> kmem_cache_init() will create generalized caches from where kmalloc() will
> allocate memory.
>
> vfs_caches_init() will create specialized caches related to VFS, like,
> dentry, inode_cache, mnt_cache....
is there clue for understanding this?
Slab cache creation either for specialized cache or generalized cache is done through kmem_cache_alloc().
kmem_cache_init() is a wrapper function which will create generalized caches again using kmem_cache_alloc()
vfs_caches_init() is a wrapper function which will create specialized caches required by VFS sub-system, again using kmem_cache_alloc().
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 ?
The answer is - this will be allocated statically as struct kmem_cache cache_cache.
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.
"The Linux Kernel Primer " - Claudia Rodriguez, Gordon Fischer & Steven Smolski
"ULK" - Daniel P Bovet.
thanks!
>
> Regards,
> Prabhunath G
> Linux Trainer
> Bangalore
>
> On Fri, Mar 15, 2013 at 10:08 AM, ishare <june.tune.sea@xxxxxxxxx> wrote:
>
> >
> > the function kmem_cache_init() is allocating which area for whom to use ?
> >
> > what is the difference comparing with vfs_caches_init() ?
> >
> > thanks!
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies@xxxxxxxxxxxxxxxxx
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
>
> --
--
Regards,
Prabhunath G
Linux Trainer
Bangalore
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies