Re: [PATCH] slub - Use local_t protection
From: Christoph Lameter
Date: Wed Sep 12 2007 - 18:28:23 EST
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/