Re: [patch 1/2] slub: move min_partial to struct kmem_cache
From: David Rientjes
Date: Mon Feb 23 2009 - 11:23:46 EST
On Mon, 23 Feb 2009, Christoph Lameter wrote:
> On Sun, 22 Feb 2009, David Rientjes wrote:
>
> > +static void calculate_min_partial(struct kmem_cache *s, unsigned long min)
> > +{
> > + if (min < MIN_PARTIAL)
> > + min = MIN_PARTIAL;
> > + else if (min > MAX_PARTIAL)
> > + min = MAX_PARTIAL;
> > + s->min_partial = min;
> > +}
> > +
> > /*
> > * calculate_sizes() determines the order and the distribution of data within
> > * a slab object.
> > @@ -2319,6 +2317,11 @@ static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags,
> > if (!calculate_sizes(s, -1))
> > goto error;
> >
> > + /*
> > + * The larger the object size is, the more pages we want on the partial
> > + * list to avoid pounding the page allocator excessively.
> > + */
> > + calculate_min_partial(s, ilog2(s->size));
> > s->refcount = 1;
> > #ifdef CONFIG_NUMA
> > s->remote_node_defrag_ratio = 1000;
> >
>
> Move the ilog2 use into calculate_min_partial()? Otherweise
> calculate_min_partial is merely enforcing limits and not doing any
> calculations.
>
The second patch in this series as a /sys/kernel/slab/cache/min_partial
tunable that uses calculate_min_partial() to enforce a sane range, so
while it may not actually be doing any calculations, the ilog2() is
appropriately placed in kmem_cache_open(). We don't want to be taking the
log of the user's min_partial value.
--
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/