Re: [PATCH] slub - Use local_t protection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 5 Sep 2007, Mathieu Desnoyers wrote:

> Use local_enter/local_exit for protection in the fast path.

Sorry that it took some time to get back to this issue. KS interfered.

> @@ -1494,8 +1487,16 @@ new_slab:
>  		c->page = new;
>  		goto load_freelist;
>  	}
> -
> +	if (gfpflags & __GFP_WAIT) {
> +		local_nest_irq_enable();
> +		local_exit();
> +	}
>  	new = new_slab(s, gfpflags, node);
> +	if (gfpflags & __GFP_WAIT) {
> +		local_enter();
> +		local_nest_irq_disable();
> +	}
> +
>  	if (new) {
>  		c = get_cpu_slab(s, smp_processor_id());
>  		if (c->page) {

Hmmmm... Definitely an interesting change to move the interrupt 
enable/disable to __slab_alloc. But it looks like it is getting a bit 
messy. All my attempts ended also like this. Sigh.

> @@ -2026,8 +2032,11 @@ static struct kmem_cache_node *early_kme
>  
>  	BUG_ON(kmalloc_caches->size < sizeof(struct kmem_cache_node));
>  
> +	if (gfpflags & __GFP_WAIT)
> +		local_irq_enable();
>  	page = new_slab(kmalloc_caches, gfpflags, node);
> -
> +	if (gfpflags & __GFP_WAIT)
> +		local_irq_disable();
>  	BUG_ON(!page);
>  	if (page_to_nid(page) != node) {
>  		printk(KERN_ERR "SLUB: Unable to allocate memory from "

Hmmmm... Actually we could drop the irq disable / enable here since this 
is boot code. That would also allow the removal of the later 
local_irq_enable.

Good idea. I think I will do the moving of the interrupt enable/disable 
independently.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux