lkml.org 
[lkml]   [2009]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 1/2] slub: move min_partial to struct kmem_cache
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.


\
 
 \ /
  Last update: 2009-02-23 17:27    [W:0.959 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site