Changeset bed78cb in mainline for kernel/generic/src/mm/slab.c


Ignore:
Timestamp:
2012-05-10T07:28:31Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
81a7858
Parents:
5b26747 (diff), fce7b43 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with mainline

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/slab.c

    r5b26747 rbed78cb  
    264264                freed = cache->destructor(obj);
    265265       
    266         spinlock_lock(&cache->slablock);
     266        irq_spinlock_lock(&cache->slablock, true);
    267267        ASSERT(slab->available < cache->objects);
    268268       
     
    275275                /* Free associated memory */
    276276                list_remove(&slab->link);
    277                 spinlock_unlock(&cache->slablock);
     277                irq_spinlock_unlock(&cache->slablock, true);
    278278               
    279279                return freed + slab_space_free(cache, slab);
     
    284284        }
    285285       
    286         spinlock_unlock(&cache->slablock);
     286        irq_spinlock_unlock(&cache->slablock, true);
    287287        return freed;
    288288}
     
    295295NO_TRACE static void *slab_obj_create(slab_cache_t *cache, unsigned int flags)
    296296{
    297         spinlock_lock(&cache->slablock);
     297        irq_spinlock_lock(&cache->slablock, true);
    298298       
    299299        slab_t *slab;
     
    308308                 *
    309309                 */
    310                 spinlock_unlock(&cache->slablock);
     310                irq_spinlock_unlock(&cache->slablock, true);
    311311                slab = slab_space_alloc(cache, flags);
    312312                if (!slab)
    313313                        return NULL;
    314314               
    315                 spinlock_lock(&cache->slablock);
     315                irq_spinlock_lock(&cache->slablock, true);
    316316        } else {
    317317                slab = list_get_instance(list_first(&cache->partial_slabs),
     
    329329                list_prepend(&slab->link, &cache->partial_slabs);
    330330       
    331         spinlock_unlock(&cache->slablock);
     331        irq_spinlock_unlock(&cache->slablock, true);
    332332       
    333333        if ((cache->constructor) && (cache->constructor(obj, flags))) {
     
    355355        link_t *cur;
    356356       
    357         spinlock_lock(&cache->maglock);
     357        irq_spinlock_lock(&cache->maglock, true);
    358358        if (!list_empty(&cache->magazines)) {
    359359                if (first)
     
    366366                atomic_dec(&cache->magazine_counter);
    367367        }
    368        
    369         spinlock_unlock(&cache->maglock);
     368        irq_spinlock_unlock(&cache->maglock, true);
     369
    370370        return mag;
    371371}
     
    377377    slab_magazine_t *mag)
    378378{
    379         spinlock_lock(&cache->maglock);
     379        irq_spinlock_lock(&cache->maglock, true);
    380380       
    381381        list_prepend(&mag->link, &cache->magazines);
    382382        atomic_inc(&cache->magazine_counter);
    383383       
    384         spinlock_unlock(&cache->maglock);
     384        irq_spinlock_unlock(&cache->maglock, true);
    385385}
    386386
     
    414414        slab_magazine_t *lastmag = cache->mag_cache[CPU->id].last;
    415415       
    416         ASSERT(spinlock_locked(&cache->mag_cache[CPU->id].lock));
     416        ASSERT(irq_spinlock_locked(&cache->mag_cache[CPU->id].lock));
    417417       
    418418        if (cmag) { /* First try local CPU magazines */
     
    451451                return NULL;
    452452       
    453         spinlock_lock(&cache->mag_cache[CPU->id].lock);
     453        irq_spinlock_lock(&cache->mag_cache[CPU->id].lock, true);
    454454       
    455455        slab_magazine_t *mag = get_full_current_mag(cache);
    456456        if (!mag) {
    457                 spinlock_unlock(&cache->mag_cache[CPU->id].lock);
     457                irq_spinlock_unlock(&cache->mag_cache[CPU->id].lock, true);
    458458                return NULL;
    459459        }
    460460       
    461461        void *obj = mag->objs[--mag->busy];
    462         spinlock_unlock(&cache->mag_cache[CPU->id].lock);
     462        irq_spinlock_unlock(&cache->mag_cache[CPU->id].lock, true);
    463463       
    464464        atomic_dec(&cache->cached_objs);
     
    481481        slab_magazine_t *lastmag = cache->mag_cache[CPU->id].last;
    482482       
    483         ASSERT(spinlock_locked(&cache->mag_cache[CPU->id].lock));
     483        ASSERT(irq_spinlock_locked(&cache->mag_cache[CPU->id].lock));
    484484       
    485485        if (cmag) {
     
    531531                return -1;
    532532       
    533         spinlock_lock(&cache->mag_cache[CPU->id].lock);
     533        irq_spinlock_lock(&cache->mag_cache[CPU->id].lock, true);
    534534       
    535535        slab_magazine_t *mag = make_empty_current_mag(cache);
    536536        if (!mag) {
    537                 spinlock_unlock(&cache->mag_cache[CPU->id].lock);
     537                irq_spinlock_unlock(&cache->mag_cache[CPU->id].lock, true);
    538538                return -1;
    539539        }
     
    541541        mag->objs[mag->busy++] = obj;
    542542       
    543         spinlock_unlock(&cache->mag_cache[CPU->id].lock);
     543        irq_spinlock_unlock(&cache->mag_cache[CPU->id].lock, true);
    544544       
    545545        atomic_inc(&cache->cached_objs);
     
    593593        for (i = 0; i < config.cpu_count; i++) {
    594594                memsetb(&cache->mag_cache[i], sizeof(cache->mag_cache[i]), 0);
    595                 spinlock_initialize(&cache->mag_cache[i].lock,
     595                irq_spinlock_initialize(&cache->mag_cache[i].lock,
    596596                    "slab.cache.mag_cache[].lock");
    597597        }
     
    624624        list_initialize(&cache->magazines);
    625625       
    626         spinlock_initialize(&cache->slablock, "slab.cache.slablock");
    627         spinlock_initialize(&cache->maglock, "slab.cache.maglock");
     626        irq_spinlock_initialize(&cache->slablock, "slab.cache.slablock");
     627        irq_spinlock_initialize(&cache->maglock, "slab.cache.maglock");
    628628       
    629629        if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
     
    704704                size_t i;
    705705                for (i = 0; i < config.cpu_count; i++) {
    706                         spinlock_lock(&cache->mag_cache[i].lock);
     706                        irq_spinlock_lock(&cache->mag_cache[i].lock, true);
    707707                       
    708708                        mag = cache->mag_cache[i].current;
     
    716716                        cache->mag_cache[i].last = NULL;
    717717                       
    718                         spinlock_unlock(&cache->mag_cache[i].lock);
     718                        irq_spinlock_unlock(&cache->mag_cache[i].lock, true);
    719719                }
    720720        }
Note: See TracChangeset for help on using the changeset viewer.