On Mon, Mar 01, 2010 at 09:24:40PM -0600, Dan Nelson wrote: > Hm. Even after some reading, I'm not sure how the slabs keep track of which > elements are allocated or free. I expected to find a bitmap somewhere that > malloc() sets and free() clears, but I don't see it. Maybe some kernel > hacker can explain it better :) Regardless, the size of the allocation at > this point isn't important, since you know all the items in the page are the > same size.
When uma_zalloc() is called it uses per CPU cache for items. Pointers to items are taken from uc_allocbucket, that contains array of pointers to items. When an item is freed its pointer goes to uc_freebucket if it has space to save this pointer. From time to time uc_allocbucket and uc_freebucket are switched (see conditions for switching in uma_zalloc() and uma_zfree()). Initially when uma_bucket structure is allocated it is filled with pointers to items from slab (note that uma_bucket is a variable sized structure). _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[email protected]"

