Re: [PATCH] slub: try to get cpu partial slab even if we get enoughobjects for cpu freelist

From: Christoph Lameter
Date: Fri Aug 17 2012 - 10:02:48 EST


On Fri, 17 Aug 2012, JoonSoo Kim wrote:

> > What difference does this patch make? At the end of the day you need the
> > total number of objects available in the partial slabs and the cpu slab
> > for comparison.
>
> It doesn't induce any large difference, but this makes code robust and
> consistent.
> Consistent code make us easily knowing what code does.

Consistency depends on the way you think about the code.

> It is somewhat odd that in first loop, we consider number of objects
> kept in cpu slab,
> but second loop exclude that number and just consider number of
> objects in cpu partial slab.

In the loop we consider the number of objects available to the cpu
without locking.

First we populate the per_cpu slab and if that does not give us enough per
cpu objects then we use the per cpu partial list to increase that number
to the desired count given by s->cpu_partial.

"available" is the number of objects available for a particular cpu
without having to go to the partial slab lists (which means having to acquire a
per node lock).

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/