OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 0/5] Kernel memory accounting container (v4)
Re: [PATCH 1/4] Add notification about some major slab events [message #20679 is a reply to message #20576] Mon, 24 September 2007 21:05 Go to previous messageGo to previous message
Christoph Lameter is currently offline  Christoph Lameter
Messages: 123
Registered: September 2006
Senior Member
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.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Thoughts on virtualizing task containers
Next Topic: [PATCH 0/3] capabilities: per-process capbset
Goto Forum:
  


Current Time: Mon Oct 27 22:20:47 GMT 2025

Total time taken to generate the page: 0.15017 seconds