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


Ignore:
Timestamp:
2011-04-13T14:45:41Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88634420
Parents:
cefb126 (diff), 17279ead (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 mainline changes.

File:
1 edited

Legend:

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

    rcefb126 r89c57b6  
    177177 *
    178178 */
    179 static slab_t *slab_space_alloc(slab_cache_t *cache, unsigned int flags)
     179NO_TRACE static slab_t *slab_space_alloc(slab_cache_t *cache,
     180    unsigned int flags)
    180181{
    181182       
     
    224225 *
    225226 */
    226 static size_t slab_space_free(slab_cache_t *cache, slab_t *slab)
     227NO_TRACE static size_t slab_space_free(slab_cache_t *cache, slab_t *slab)
    227228{
    228229        frame_free(KA2PA(slab->start));
     
    236237
    237238/** Map object to slab structure */
    238 static slab_t *obj2slab(void *obj)
     239NO_TRACE static slab_t *obj2slab(void *obj)
    239240{
    240241        return (slab_t *) frame_get_parent(ADDR2PFN(KA2PA(obj)), 0);
     
    252253 *
    253254 */
    254 static size_t slab_obj_destroy(slab_cache_t *cache, void *obj, slab_t *slab)
     255NO_TRACE static size_t slab_obj_destroy(slab_cache_t *cache, void *obj,
     256    slab_t *slab)
    255257{
    256258        if (!slab)
     
    293295 *
    294296 */
    295 static void *slab_obj_create(slab_cache_t *cache, int flags)
     297NO_TRACE static void *slab_obj_create(slab_cache_t *cache, unsigned int flags)
    296298{
    297299        spinlock_lock(&cache->slablock);
     
    349351 *
    350352 */
    351 static slab_magazine_t *get_mag_from_cache(slab_cache_t *cache, bool first)
     353NO_TRACE static slab_magazine_t *get_mag_from_cache(slab_cache_t *cache,
     354    bool first)
    352355{
    353356        slab_magazine_t *mag = NULL;
     
    373376 *
    374377 */
    375 static void put_mag_to_cache(slab_cache_t *cache, slab_magazine_t *mag)
     378NO_TRACE static void put_mag_to_cache(slab_cache_t *cache,
     379    slab_magazine_t *mag)
    376380{
    377381        spinlock_lock(&cache->maglock);
     
    388392 *
    389393 */
    390 static size_t magazine_destroy(slab_cache_t *cache, slab_magazine_t *mag)
     394NO_TRACE static size_t magazine_destroy(slab_cache_t *cache,
     395    slab_magazine_t *mag)
    391396{
    392397        size_t i;
     
    406411 *
    407412 */
    408 static slab_magazine_t *get_full_current_mag(slab_cache_t *cache)
     413NO_TRACE static slab_magazine_t *get_full_current_mag(slab_cache_t *cache)
    409414{
    410415        slab_magazine_t *cmag = cache->mag_cache[CPU->id].current;
    411416        slab_magazine_t *lastmag = cache->mag_cache[CPU->id].last;
    412 
     417       
    413418        ASSERT(spinlock_locked(&cache->mag_cache[CPU->id].lock));
    414419       
     
    443448 *
    444449 */
    445 static void *magazine_obj_get(slab_cache_t *cache)
     450NO_TRACE static void *magazine_obj_get(slab_cache_t *cache)
    446451{
    447452        if (!CPU)
     
    473478 *
    474479 */
    475 static slab_magazine_t *make_empty_current_mag(slab_cache_t *cache)
     480NO_TRACE static slab_magazine_t *make_empty_current_mag(slab_cache_t *cache)
    476481{
    477482        slab_magazine_t *cmag = cache->mag_cache[CPU->id].current;
     
    479484       
    480485        ASSERT(spinlock_locked(&cache->mag_cache[CPU->id].lock));
    481 
     486       
    482487        if (cmag) {
    483488                if (cmag->busy < cmag->size)
     
    523528 *
    524529 */
    525 static int magazine_obj_put(slab_cache_t *cache, void *obj)
     530NO_TRACE static int magazine_obj_put(slab_cache_t *cache, void *obj)
    526531{
    527532        if (!CPU)
     
    552557 *
    553558 */
    554 static size_t comp_objects(slab_cache_t *cache)
     559NO_TRACE static size_t comp_objects(slab_cache_t *cache)
    555560{
    556561        if (cache->flags & SLAB_CACHE_SLINSIDE)
     
    564569 *
    565570 */
    566 static size_t badness(slab_cache_t *cache)
     571NO_TRACE static size_t badness(slab_cache_t *cache)
    567572{
    568573        size_t objects = comp_objects(cache);
     
    578583 *
    579584 */
    580 static bool make_magcache(slab_cache_t *cache)
     585NO_TRACE static bool make_magcache(slab_cache_t *cache)
    581586{
    582587        ASSERT(_slab_initialized >= 2);
     
    600605 *
    601606 */
    602 static void _slab_cache_create(slab_cache_t *cache, const char *name,
     607NO_TRACE static void _slab_cache_create(slab_cache_t *cache, const char *name,
    603608    size_t size, size_t align, int (*constructor)(void *obj,
    604609    unsigned int kmflag), size_t (*destructor)(void *obj), unsigned int flags)
     
    607612        cache->name = name;
    608613       
    609         if (align < sizeof(unative_t))
    610                 align = sizeof(unative_t);
     614        if (align < sizeof(sysarg_t))
     615                align = sizeof(sysarg_t);
    611616       
    612617        size = ALIGN_UP(size, align);
     
    676681 *
    677682 */
    678 static size_t _slab_reclaim(slab_cache_t *cache, unsigned int flags)
     683NO_TRACE static size_t _slab_reclaim(slab_cache_t *cache, unsigned int flags)
    679684{
    680685        if (cache->flags & SLAB_CACHE_NOMAGAZINE)
     
    781786 *
    782787 */
    783 static void _slab_free(slab_cache_t *cache, void *obj, slab_t *slab)
     788NO_TRACE static void _slab_free(slab_cache_t *cache, void *obj, slab_t *slab)
    784789{
    785790        ipl_t ipl = interrupts_disable();
     
    801806}
    802807
    803 /** Go through all caches and reclaim what is possible
    804  *
    805  * Interrupts must be disabled before calling this function,
    806  * otherwise  memory allocation from interrupts can deadlock.
    807  *
    808  */
     808/** Go through all caches and reclaim what is possible */
    809809size_t slab_reclaim(unsigned int flags)
    810810{
    811         irq_spinlock_lock(&slab_cache_lock, false);
     811        irq_spinlock_lock(&slab_cache_lock, true);
    812812       
    813813        size_t frames = 0;
     
    819819        }
    820820       
    821         irq_spinlock_unlock(&slab_cache_lock, false);
     821        irq_spinlock_unlock(&slab_cache_lock, true);
    822822       
    823823        return frames;
     
    885885                irq_spinlock_unlock(&slab_cache_lock, true);
    886886               
    887                 printf("%-18s %8" PRIs " %8u %8" PRIs " %8ld %8ld %8ld %-5s\n",
     887                printf("%-18s %8zu %8u %8zu %8ld %8ld %8ld %-5s\n",
    888888                    name, size, (1 << order), objects, allocated_slabs,
    889889                    cached_objs, allocated_objs,
Note: See TracChangeset for help on using the changeset viewer.