[lkml]   [2009]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    SubjectRe: [patch 1/3] slub: add per-cache slab thrash ratio
    On Mon, 30 Mar 2009, Pekka Enberg wrote:

    > > The slab_thrash_ratio for each cache do not have non-zero defaults
    > > (yet?).
    > If we're going to merge this code, I think it would be better to put a
    > non-zero default there; otherwise we won't be able to hit potential
    > performance regressions or bugs. Furthermore, the optimization is not
    > very useful on large scale if people need to enable it themselves.
    > Maybe stick 20 there and run tbench, sysbench, et al to see if it makes
    > a difference? I'm cc'ing Mel in case he has some suggestions how to test
    > it.

    It won't cause a regression if sane SLAB_THRASHING_THRESHOLD and
    slab_thrash_ratio values are set since the contention on list_lock will
    always be slower than utilizing a more free cpu slab when its thrashing.

    I agree that there should be a default value and I was originally going
    to propose the following as the fourth patch in the series, but I wanted
    to generate commentary on the approach first and there's always a
    hesitation when changing the default behavior of the entire allocator for
    workloads with very specific behavior that trigger this type of problem.

    The fact that we need a tunable for this is unfortunate, but there doesn't
    seem to be any other way to detect such situations and adjust the partial
    list handling so that list_lock isn't contended so much and the allocation
    slowpath to fastpath ratio isn't so high.

    I'd be interested to hear other people's approaches.
    diff --git a/mm/slub.c b/mm/slub.c
    --- a/mm/slub.c
    +++ b/mm/slub.c
    @@ -147,6 +147,12 @@

    + * Default slab thrash ratio, used to define when a slab is thrashing for a
    + * particular cpu.
    + */

    @@ -2392,7 +2398,14 @@ static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags,
    set_min_partial(s, ilog2(s->size));
    s->refcount = 1;
    - s->min_free_watermark = 0;
    + s->min_free_watermark = oo_objects(s->oo) *
    + /*
    + * It doesn't make sense to define a slab as thrashing if its threshold
    + * is fewer than 4 objects.
    + */
    + if (s->min_free_watermark < 4)
    + s->min_free_watermark = 0;
    #ifdef CONFIG_NUMA
    s->remote_node_defrag_ratio = 1000;

     \ /
      Last update: 2009-03-30 10:45    [W:0.022 / U:35.856 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site