Re: [PATCH] net: via-velocity.c fix sleep-with-spinlock bug duringMTU change

From: Francois Romieu
Date: Tue Jun 03 2008 - 18:19:23 EST


Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> :
[...]
> So hrm. It could all be a lot better. Just looking quickly at the
> code I _think_ we might be able to do all the needed allocations
> outside the lock and then swizzle them into place after taking the
> lock. ie, something as simple as:
[...]
> velocity_init_rd_ring(temp_vptr); /* Can use GFP_KERNEL! */
>
> spin_lock_irqsave(&vptr->lock, flags);
>
> velocity_free_td_ring(vptr);
> velocity_free_rd_ring(vptr);
>
> vptr->foo = temp_vptr->foo;
> vptr->bar = temp_vptr->bar;
> ...
>
> spin_unlock_irqrestore(&vptr->lock, flags);
>
> ?

Almost.

I'll wrap it in the next 24 hours.

--
Ueimor
--
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/