Changeset 214f5bb in mainline
- Timestamp:
- 2006-02-06T01:43:24Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c7ec94a4
- Parents:
- c585827
- Location:
- generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/mm/slab.h
rc585827 r214f5bb 35 35 36 36 /** Minimum size to be allocated by malloc */ 37 #define SLAB_MIN_MALLOC_W 337 #define SLAB_MIN_MALLOC_W 4 38 38 39 39 /** Maximum size to be allocated by malloc */ -
generic/src/mm/slab.c
rc585827 r214f5bb 113 113 /** Cache for cache descriptors */ 114 114 static slab_cache_t slab_cache_cache; 115 /** Cache for magcache structure from cache_t */116 static slab_cache_t *cpu_cache = NULL;117 115 /** Cache for external slab descriptors 118 116 * This time we want per-cpu cache, so do not make it static … … 125 123 static slab_cache_t *malloc_caches[SLAB_MAX_MALLOC_W-SLAB_MIN_MALLOC_W+1]; 126 124 char *malloc_names[] = { 127 "malloc- 8","malloc-16","malloc-32","malloc-64","malloc-128",125 "malloc-16","malloc-32","malloc-64","malloc-128", 128 126 "malloc-256","malloc-512","malloc-1K","malloc-2K", 129 127 "malloc-4K","malloc-8K","malloc-16K","malloc-32K", … … 139 137 index_t nextavail; /**< The index of next available item */ 140 138 }slab_t; 139 140 #ifdef CONFIG_DEBUG 141 static int _slab_initialized = 0; 142 #endif 141 143 142 144 /**************************************/ … … 544 546 { 545 547 int i; 546 547 ASSERT(cpu_cache); 548 cache->mag_cache = slab_alloc(cpu_cache, 0); 548 549 ASSERT(_slab_initialized >= 2); 550 551 cache->mag_cache = kalloc(sizeof(slab_mag_cache_t)*config.cpu_count,0); 549 552 for (i=0; i < config.cpu_count; i++) { 550 553 memsetb((__address)&cache->mag_cache[i], … … 709 712 710 713 if (!(cache->flags & SLAB_CACHE_NOMAGAZINE)) 711 slab_free(cpu_cache,cache->mag_cache);714 kfree(cache->mag_cache); 712 715 slab_free(&slab_cache_cache, cache); 713 716 } … … 805 808 interrupts_restore(ipl); 806 809 } 807 808 #ifdef CONFIG_DEBUG809 static int _slab_initialized = 0;810 #endif811 810 812 811 void slab_cache_init(void) … … 859 858 slab_cache_t *s; 860 859 861 cpu_cache = slab_cache_create("magcpucache", 862 sizeof(slab_mag_cache_t) * config.cpu_count,863 0, NULL, NULL, 864 SLAB_CACHE_NOMAGAZINE); 860 #ifdef CONFIG_DEBUG 861 _slab_initialized = 2; 862 #endif 863 865 864 spinlock_lock(&slab_cache_lock); 866 865
Note:
See TracChangeset
for help on using the changeset viewer.