objcache depot not used?
Nicolas Thery
nthery at gmail.com
Mon Jan 28 13:18:09 PST 2008
2008/1/28, Matthew Dillon <dillon at apollo.backplane.com>:
> See line 536 or so of kern_objcache.c What happens is that,
> ultimately, a magazine will become completely full of free items.
> (full magazine == completely full of items available for
> allocation).
>
> When the two per-cpu magazines become full one will be moved
> to the depot and an empty magazine will be recycled from the
> depot.
Um, I did some testing and I still don't get it.
One of the full magazine will be moved to the depot if and only if
there is an empty magazine in the depot in the first place:
548 /*
549 * If an empty magazine is available in the depot, cycle it
550 * through and retry.
551 */
552 if (!SLIST_EMPTY(&depot->emptymagazines)) {
This does not seem to be the case (the depot is initially empty). As a
consequence, the path taken is:
578 /*
579 * An empty mag is not available. This is a corner case which can
580 * occur due to cpus holding partially full magazines. Do not try
581 * to allocate a mag, just free the object.
582 */
As a further test, I allocated an empty mag in objcache_create() and stored
it in the depot (emptymagazines). With this, the allocator behaves as you
describe.
Cheers,
Nicolas
More information about the Kernel
mailing list