Rev 2745 | Rev 3104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2745 | Rev 3057 | ||
---|---|---|---|
Line 555... | Line 555... | ||
555 | { |
555 | { |
556 | unsigned int i; |
556 | unsigned int i; |
557 | 557 | ||
558 | ASSERT(_slab_initialized >= 2); |
558 | ASSERT(_slab_initialized >= 2); |
559 | 559 | ||
560 | cache->mag_cache = malloc(sizeof(slab_mag_cache_t)*config.cpu_count,0); |
560 | cache->mag_cache = malloc(sizeof(slab_mag_cache_t) * config.cpu_count,0); |
561 | for (i = 0; i < config.cpu_count; i++) { |
561 | for (i = 0; i < config.cpu_count; i++) { |
562 | memsetb((uintptr_t)&cache->mag_cache[i], |
562 | memsetb((uintptr_t)&cache->mag_cache[i], |
563 | sizeof(cache->mag_cache[i]), 0); |
563 | sizeof(cache->mag_cache[i]), 0); |
564 | spinlock_initialize(&cache->mag_cache[i].lock, "slab_maglock_cpu"); |
564 | spinlock_initialize(&cache->mag_cache[i].lock, "slab_maglock_cpu"); |
565 | } |
565 | } |
Line 811... | Line 811... | ||
811 | printf("---------------- -------- ------ ------ ------ ------ --------- ---\n"); |
811 | printf("---------------- -------- ------ ------ ------ ------ --------- ---\n"); |
812 | 812 | ||
813 | for (cur = slab_cache_list.next; cur != &slab_cache_list; cur = cur->next) { |
813 | for (cur = slab_cache_list.next; cur != &slab_cache_list; cur = cur->next) { |
814 | cache = list_get_instance(cur, slab_cache_t, link); |
814 | cache = list_get_instance(cur, slab_cache_t, link); |
815 | 815 | ||
- | 816 | printf("%-16s %8" PRIs " %6d %6u %6ld %6ld %9ld %-3s\n", |
|
- | 817 | cache->name, cache->size, (1 << cache->order), cache->objects, |
|
- | 818 | atomic_get(&cache->allocated_slabs), atomic_get(&cache->cached_objs), |
|
816 | printf("%-16s %8zd %6zd %6zd %6zd %6zd %9zd %-3s\n", cache->name, cache->size, (1 << cache->order), cache->objects, atomic_get(&cache->allocated_slabs), atomic_get(&cache->cached_objs), atomic_get(&cache->allocated_objs), cache->flags & SLAB_CACHE_SLINSIDE ? "in" : "out"); |
819 | atomic_get(&cache->allocated_objs), cache->flags & SLAB_CACHE_SLINSIDE ? "in" : "out"); |
817 | } |
820 | } |
818 | spinlock_unlock(&slab_cache_lock); |
821 | spinlock_unlock(&slab_cache_lock); |
819 | interrupts_restore(ipl); |
822 | interrupts_restore(ipl); |
820 | } |
823 | } |
821 | 824 | ||
Line 824... | Line 827... | ||
824 | int i, size; |
827 | int i, size; |
825 | 828 | ||
826 | /* Initialize magazine cache */ |
829 | /* Initialize magazine cache */ |
827 | _slab_cache_create(&mag_cache, |
830 | _slab_cache_create(&mag_cache, |
828 | "slab_magazine", |
831 | "slab_magazine", |
829 | sizeof(slab_magazine_t)+SLAB_MAG_SIZE*sizeof(void*), |
832 | sizeof(slab_magazine_t) + SLAB_MAG_SIZE * sizeof(void*), |
830 | sizeof(uintptr_t), |
833 | sizeof(uintptr_t), |
831 | NULL, NULL, |
834 | NULL, NULL, |
832 | SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE); |
835 | SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE); |
833 | /* Initialize slab_cache cache */ |
836 | /* Initialize slab_cache cache */ |
834 | _slab_cache_create(&slab_cache_cache, |
837 | _slab_cache_create(&slab_cache_cache, |
Line 842... | Line 845... | ||
842 | sizeof(slab_t), |
845 | sizeof(slab_t), |
843 | 0, NULL, NULL, |
846 | 0, NULL, NULL, |
844 | SLAB_CACHE_SLINSIDE | SLAB_CACHE_MAGDEFERRED); |
847 | SLAB_CACHE_SLINSIDE | SLAB_CACHE_MAGDEFERRED); |
845 | 848 | ||
846 | /* Initialize structures for malloc */ |
849 | /* Initialize structures for malloc */ |
847 | for (i=0, size=(1<<SLAB_MIN_MALLOC_W); |
850 | for (i=0, size=(1 << SLAB_MIN_MALLOC_W); |
848 | i < (SLAB_MAX_MALLOC_W-SLAB_MIN_MALLOC_W+1); |
851 | i < (SLAB_MAX_MALLOC_W - SLAB_MIN_MALLOC_W + 1); |
849 | i++, size <<= 1) { |
852 | i++, size <<= 1) { |
850 | malloc_caches[i] = slab_cache_create(malloc_names[i], |
853 | malloc_caches[i] = slab_cache_create(malloc_names[i], |
851 | size, 0, |
854 | size, 0, |
852 | NULL,NULL, SLAB_CACHE_MAGDEFERRED); |
855 | NULL,NULL, SLAB_CACHE_MAGDEFERRED); |
853 | } |
856 | } |