Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ddb56be in mainline


Ignore:
Timestamp:
2012-05-08T09:20:18Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
4d194be
Parents:
c8d0f9e5
Message:

Convert slab_cache_t's slablock into an IRQ spinlock as it is taken from
a callpath called from slab_cache_destroy(), which does not disable
interrupts.

Location:
kernel/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/mm/slab.h

    rc8d0f9e5 rddb56be  
    113113        list_t full_slabs;     /**< List of full slabs */
    114114        list_t partial_slabs;  /**< List of partial slabs */
    115         SPINLOCK_DECLARE(slablock);
     115        IRQ_SPINLOCK_DECLARE(slablock);
    116116        /* Magazines */
    117117        list_t magazines;  /**< List o full magazines */
  • kernel/generic/src/mm/slab.c

    rc8d0f9e5 rddb56be  
    254254    slab_t *slab)
    255255{
    256         ASSERT(interrupts_disabled());
    257 
    258256        if (!slab)
    259257                slab = obj2slab(obj);
     
    266264                freed = cache->destructor(obj);
    267265       
    268         spinlock_lock(&cache->slablock);
     266        irq_spinlock_lock(&cache->slablock, true);
    269267        ASSERT(slab->available < cache->objects);
    270268       
     
    277275                /* Free associated memory */
    278276                list_remove(&slab->link);
    279                 spinlock_unlock(&cache->slablock);
     277                irq_spinlock_unlock(&cache->slablock, true);
    280278               
    281279                return freed + slab_space_free(cache, slab);
     
    286284        }
    287285       
    288         spinlock_unlock(&cache->slablock);
     286        irq_spinlock_unlock(&cache->slablock, true);
    289287        return freed;
    290288}
     
    297295NO_TRACE static void *slab_obj_create(slab_cache_t *cache, unsigned int flags)
    298296{
    299         ASSERT(interrupts_disabled());
    300 
    301         spinlock_lock(&cache->slablock);
     297        irq_spinlock_lock(&cache->slablock, true);
    302298       
    303299        slab_t *slab;
     
    312308                 *
    313309                 */
    314                 spinlock_unlock(&cache->slablock);
     310                irq_spinlock_unlock(&cache->slablock, true);
    315311                slab = slab_space_alloc(cache, flags);
    316312                if (!slab)
    317313                        return NULL;
    318314               
    319                 spinlock_lock(&cache->slablock);
     315                irq_spinlock_lock(&cache->slablock, true);
    320316        } else {
    321317                slab = list_get_instance(list_first(&cache->partial_slabs),
     
    333329                list_prepend(&slab->link, &cache->partial_slabs);
    334330       
    335         spinlock_unlock(&cache->slablock);
     331        irq_spinlock_unlock(&cache->slablock, true);
    336332       
    337333        if ((cache->constructor) && (cache->constructor(obj, flags))) {
     
    632628        list_initialize(&cache->magazines);
    633629       
    634         spinlock_initialize(&cache->slablock, "slab.cache.slablock");
     630        irq_spinlock_initialize(&cache->slablock, "slab.cache.slablock");
    635631        spinlock_initialize(&cache->maglock, "slab.cache.maglock");
    636632       
Note: See TracChangeset for help on using the changeset viewer.