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


Ignore:
Timestamp:
2010-05-21T07:50:04Z (16 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d51ee2b
Parents:
cf8cc36 (diff), 15b592b (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 (rev. 451)

File:
1 edited

Legend:

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

    rcf8cc36 rc47e1a8  
    130130/** Caches for malloc */
    131131static slab_cache_t *malloc_caches[SLAB_MAX_MALLOC_W - SLAB_MIN_MALLOC_W + 1];
    132 static char *malloc_names[] =  {
     132static const char *malloc_names[] =  {
    133133        "malloc-16",
    134134        "malloc-32",
     
    555555 * Initialize mag_cache structure in slab cache
    556556 */
    557 static void make_magcache(slab_cache_t *cache)
     557static bool make_magcache(slab_cache_t *cache)
    558558{
    559559        unsigned int i;
     
    562562
    563563        cache->mag_cache = malloc(sizeof(slab_mag_cache_t) * config.cpu_count,
    564             0);
     564            FRAME_ATOMIC);
     565        if (!cache->mag_cache)
     566                return false;
     567
    565568        for (i = 0; i < config.cpu_count; i++) {
    566569                memsetb(&cache->mag_cache[i], sizeof(cache->mag_cache[i]), 0);
     
    568571                    "slab_maglock_cpu");
    569572        }
     573        return true;
    570574}
    571575
    572576/** Initialize allocated memory as a slab cache */
    573 static void
    574 _slab_cache_create(slab_cache_t *cache, char *name, size_t size, size_t align,
    575     int (*constructor)(void *obj, int kmflag), int (*destructor)(void *obj),
    576     int flags)
     577static void _slab_cache_create(slab_cache_t *cache, const char *name,
     578    size_t size, size_t align, int (*constructor)(void *obj, int kmflag),
     579    int (*destructor)(void *obj), int flags)
    577580{
    578581        int pages;
     
    598601        spinlock_initialize(&cache->maglock, "slab_maglock");
    599602        if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
    600                 make_magcache(cache);
     603                (void) make_magcache(cache);
    601604
    602605        /* Compute slab sizes, object counts in slabs etc. */
     
    631634
    632635/** Create slab cache  */
    633 slab_cache_t *
    634 slab_cache_create(char *name, size_t size, size_t align,
     636slab_cache_t *slab_cache_create(const char *name, size_t size, size_t align,
    635637    int (*constructor)(void *obj, int kmflag), int (*destructor)(void *obj),
    636638    int flags)
     
    853855                cache = list_get_instance(cur, slab_cache_t, link);
    854856
    855                 char *name = cache->name;
     857                const char *name = cache->name;
    856858                uint8_t order = cache->order;
    857859                size_t size = cache->size;
     
    896898                    NULL, NULL, SLAB_CACHE_MAGDEFERRED);
    897899        }
    898 #ifdef CONFIG_DEBUG       
     900#ifdef CONFIG_DEBUG
    899901        _slab_initialized = 1;
    900902#endif
     
    925927                    SLAB_CACHE_MAGDEFERRED)
    926928                        continue;
    927                 make_magcache(s);
     929                (void) make_magcache(s);
    928930                s->flags &= ~SLAB_CACHE_MAGDEFERRED;
    929931        }
Note: See TracChangeset for help on using the changeset viewer.