kmem_cache_init
Prabhu nath
gprabhunath at gmail.com
Sun Mar 17 04:41:58 EDT 2013
On Fri, Mar 15, 2013 at 6:08 PM, ishare <june.tune.sea at gmail.com> wrote:
> On Fri, Mar 15, 2013 at 11:39:07AM +0530, Prabhu nath wrote:
> > 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....
>
> what is the relation between cache_cache and these two functions?
> 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 at gmail.com>
> 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 at kernelnewbies.org
> > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > >
> >
> >
> >
> > --
>
--
Regards,
Prabhunath G
Linux Trainer
Bangalore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130317/3f18e678/attachment.html
More information about the Kernelnewbies
mailing list