[lkml]   [2002]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] kmem_cache_zalloc
Date said:
> I thought that the life span of an object is between
> kmem_cache_alloc and kmem_cache_free. If you are expecting caching
> beyond this, you may not get correct data. kmem_cache allocator is
> supposed to quickly allocate fixed size structures avoiding the need
> for frequent splitting and coalescing in the allocator.

> Am I missing something here ?

Yes. Slab objects can be initialised once when a new page is added to the
slab, and returned to the slab in reusable form so that you don't have the
cost of complete initialisation on each allocation.

So if for example you have a semaphore in your slab object, instead of
initialising it on each kmem_cache_alloc() you do it once when the new pages
are added to the slab. Then you just make sure it's unlocked each time you
free a slab object.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:25    [W:0.030 / U:2.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site