Re: SLUB: Fix dynamic dma kmalloc cache creation

Christoph Lameter
2007-08-10T17:40:15Z

On Fri, 10 Aug 2007, Andrew Morton wrote:

> Well that was fairly foul. What was wrong wih turning slub_lock into a
> spinlock?

It would make things even worse because we would have always to do atomic
allocs when holding the lock. Or allocate before and then take the
lock to check if someone else has created it. If so we would need to fall
back meaning we cannot avoid kmem_cache_destroy() from dynamic cache
creation. The trylock avoids the kmem_cache_destroy() and is minimally
invasive.

> > + schedule_work(&sysfs_add_work);
>
> sysfs_add_work could be already pending, or running. boom.

sysfs_add_work takes the slub_lock. It cannot be running.