lkml.org 
[lkml]   [2011]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[slubllv3 19/21] slub: fast release on full slab
    Make deactivation occur implicitly while checking out the current freelist.

    This avoids one cmpxchg operation on a slab that is now fully in use.

    Signed-off-by: Christoph Lameter <cl@linux.com>

    ---
    mm/slub.c | 18 ++++++++++++++++--
    1 file changed, 16 insertions(+), 2 deletions(-)

    Index: linux-2.6/mm/slub.c
    ===================================================================
    --- linux-2.6.orig/mm/slub.c 2011-04-15 14:30:10.000000000 -0500
    +++ linux-2.6/mm/slub.c 2011-04-15 14:30:12.000000000 -0500
    @@ -1953,9 +1953,21 @@ static void *__slab_alloc(struct kmem_ca
    object = page->freelist;
    counters = page->counters;
    new.counters = counters;
    - new.inuse = page->objects;
    VM_BUG_ON(!new.frozen);

    + /*
    + * If there is no object left then we use this loop to
    + * deactivate the slab which is simple since no objects
    + * are left in the slab and therefore we do not need to
    + * put the page back onto the partial list.
    + *
    + * If there are objects left then we retrieve them
    + * and use them to refill the per cpu queue.
    + */
    +
    + new.inuse = page->objects;
    + new.frozen = object != NULL;
    +
    } while (!cmpxchg_double_slab(s, page,
    object, counters,
    NULL, new.counters,
    @@ -1965,8 +1977,10 @@ static void *__slab_alloc(struct kmem_ca
    load_freelist:
    VM_BUG_ON(!page->frozen);

    - if (unlikely(!object))
    + if (unlikely(!object)) {
    + c->page = NULL;
    goto new_slab;
    + }

    c->freelist = get_freepointer(s, object);



    \
     
     \ /
      Last update: 2011-04-15 22:51    [W:0.027 / U:29.592 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site