[Devel] Re: [PATCH 1/4] Add notification about some major slab events
Christoph Lameter
clameter at sgi.com
Mon Sep 24 14:05:07 PDT 2007
On Fri, 21 Sep 2007, Pavel Emelyanov wrote:
> @@ -1486,7 +1597,7 @@ load_freelist:
> object = c->page->freelist;
> if (unlikely(!object))
> goto another_slab;
> - if (unlikely(SlabDebug(c->page)))
> + if (unlikely(SlabDebug(c->page)) || (s->flags & SLAB_NOTIFY))
> goto debug;
There is no need to check s->flags & SLAB_NOTIFY here. Just make sure that
SlabDebug() is always set on allocated slabs. Set SlabDebug when a slab
page is allocated is sufficient.
> debug:
> object = c->page->freelist;
> - if (!alloc_debug_processing(s, c->page, object, addr))
> + if (SlabDebug(c->page) &&
> + !alloc_debug_processing(s, c->page, object, addr))
> goto another_slab;
>
SlabDebug will always be set and does not need to be tested.
> + if ((s->flags & SLAB_NOTIFY) &&
> + slub_alloc_notify(s, object, gfpflags) < 0) {
> + object = NULL;
> + goto out;
> + }
Looks like the above piece is the only addition we need in __slab_alloc().
> @@ -1620,7 +1739,7 @@ static void __slab_free(struct kmem_cach
>
> slab_lock(page);
>
> - if (unlikely(SlabDebug(page)))
> + if (unlikely(SlabDebug(page)) || (s->flags & SLAB_NOTIFY))
> goto debug;
Not needed either.
> checks_ok:
> prior = object[offset] = page->freelist;
> @@ -1657,8 +1776,12 @@ slab_empty:
> return;
>
> debug:
> - if (!free_debug_processing(s, page, x, addr))
> + if (SlabDebug(page) && !free_debug_processing(s, page, x, addr))
> goto out_unlock;
Ditto.
> +
> + if (s->flags & SLAB_NOTIFY)
> + slub_free_notify(s, x);
> +
Yup we need this for __slab_free.
More information about the Devel
mailing list