void *priv, void *vmp)
{
kmem_cache_cb_t *kcc;
+ unsigned long flags;
kcc = (kmem_cache_cb_t *)kmalloc(sizeof(*kcc), GFP_KERNEL);
if (kcc) {
kcc->kcc_reclaim = reclaim;
kcc->kcc_private = priv;
kcc->kcc_vmp = vmp;
- spin_lock(&kmem_cache_cb_lock);
+ spin_lock_irqsave(&kmem_cache_cb_lock, flags);
list_add(&kcc->kcc_list, &kmem_cache_cb_list);
- spin_unlock(&kmem_cache_cb_lock);
+ spin_unlock_irqrestore(&kmem_cache_cb_lock, flags);
}
return kcc;
static void
kmem_cache_remove_cache_cb(kmem_cache_cb_t *kcc)
{
- spin_lock(&kmem_cache_cb_lock);
+ unsigned long flags;
+
+ spin_lock_irqsave(&kmem_cache_cb_lock, flags);
list_del(&kcc->kcc_list);
- spin_unlock(&kmem_cache_cb_lock);
+ spin_unlock_irqrestore(&kmem_cache_cb_lock, flags);
if (kcc)
kfree(kcc);
{
kmem_cache_cb_t *kcc;
kmem_constructor_t constructor;
+ unsigned long irqflags;
void *private;
- spin_lock(&kmem_cache_cb_lock);
+ spin_lock_irqsave(&kmem_cache_cb_lock, irqflags);
/* Callback list must be in sync with linux slab caches */
kcc = kmem_cache_find_cache_cb(cache);
constructor = kcc->kcc_constructor;
private = kcc->kcc_private;
- spin_unlock(&kmem_cache_cb_lock);
+ spin_unlock_irqrestore(&kmem_cache_cb_lock, irqflags);
if (constructor)
constructor(ptr, private, (int)flags);
{
kmem_cache_cb_t *kcc;
kmem_destructor_t destructor;
+ unsigned long irqflags;
void *private;
- spin_lock(&kmem_cache_cb_lock);
+ spin_lock_irqsave(&kmem_cache_cb_lock, irqflags);
/* Callback list must be in sync with linux slab caches */
kcc = kmem_cache_find_cache_cb(cache);
destructor = kcc->kcc_destructor;
private = kcc->kcc_private;
- spin_unlock(&kmem_cache_cb_lock);
+ spin_unlock_irqrestore(&kmem_cache_cb_lock, irqflags);
/* Solaris destructor takes no flags, silently eat them */
if (destructor)
kmem_cache_generic_shrinker(int nr_to_scan, unsigned int gfp_mask)
{
kmem_cache_cb_t *kcc;
+ unsigned long flags;
int total = 0;
/* Under linux a shrinker is not tightly coupled with a slab
* function in the shim layer for all slab caches. And we always
* attempt to shrink all caches when this generic shrinker is called.
*/
- spin_lock(&kmem_cache_cb_lock);
+ spin_lock_irqsave(&kmem_cache_cb_lock, flags);
list_for_each_entry(kcc, &kmem_cache_cb_list, kcc_list) {
/* Under linux the desired number and gfp type of objects
* was registered with the generic shrinker. This should fake out
* the linux VM when it attempts to shrink caches.
*/
- spin_unlock(&kmem_cache_cb_lock);
+ spin_unlock_irqrestore(&kmem_cache_cb_lock, flags);
return total;
}
{
kmem_cache_cb_t *kcc;
char *name;
+ unsigned long flags;
int rc;
- spin_lock(&kmem_cache_cb_lock);
+ spin_lock_irqsave(&kmem_cache_cb_lock, flags);
kcc = kmem_cache_find_cache_cb(cache);
- spin_unlock(&kmem_cache_cb_lock);
+ spin_unlock_irqrestore(&kmem_cache_cb_lock, flags);
if (kcc == NULL)
return -EINVAL;
kfree(name);
/* Unregister generic shrinker on removal of all caches */
- spin_lock(&kmem_cache_cb_lock);
+ spin_lock_irqsave(&kmem_cache_cb_lock, flags);
if (list_empty(&kmem_cache_cb_list))
remove_shrinker(kmem_cache_shrinker);
- spin_unlock(&kmem_cache_cb_lock);
+ spin_unlock_irqrestore(&kmem_cache_cb_lock, flags);
return rc;
}
EXPORT_SYMBOL(__kmem_cache_destroy);