Changeset 14e5d88 in mainline for generic/src
- Timestamp:
- 2006-02-02T21:46:47Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4a5b2b0e
- Parents:
- 086d4fd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/mm/slab.c
r086d4fd r14e5d88 89 89 /* Fill in slab structures */ 90 90 /* TODO: some better way of accessing the frame */ 91 for (i=0; i < (1<<cache->order); i++) {91 for (i=0; i < (1 << cache->order); i++) { 92 92 frame = ADDR2FRAME(zone, KA2PA((__address)(data+i*PAGE_SIZE))); 93 93 frame->parent = slab; … … 107 107 108 108 /** 109 * Free space associated with SLAB109 * Deallocate space associated with SLAB 110 110 * 111 111 * @return number of freed frames … … 151 151 if (!slab) 152 152 slab = obj2slab(obj); 153 154 spinlock_lock(&cache->lock);155 153 156 154 *((int *)obj) = slab->nextavail; … … 172 170 spinlock_lock(&cache->lock); 173 171 } 174 175 spinlock_unlock(&cache->lock);176 172 177 173 return frames; … … 389 385 cache->name = name; 390 386 391 if (align) 392 size = ALIGN_UP(size, align); 387 if (align < sizeof(__native)) 388 align = sizeof(__native); 389 size = ALIGN_UP(size, align); 390 393 391 cache->size = size; 394 392 … … 412 410 413 411 /* Minimum slab order */ 414 cache->order = (cache->size >> PAGE_WIDTH) + 1;415 412 cache->order = (cache->size-1) >> PAGE_WIDTH; 413 416 414 while (badness(cache) > SLAB_MAX_BADNESS(cache)) { 417 415 cache->order += 1; 418 416 } 419 420 417 cache->objects = comp_objects(cache); 418 /* If info fits in, put it inside */ 419 if (badness(cache) > sizeof(slab_t)) 420 cache->flags |= SLAB_CACHE_SLINSIDE; 421 421 422 422 spinlock_lock(&slab_cache_lock); … … 597 597 598 598 spinlock_lock(&slab_cache_lock); 599 printf("SLAB name\tOsize\t Order\tOcnt\tSlabs\tAllocobjs\n");599 printf("SLAB name\tOsize\tPages\tOcnt\tSlabs\tAllocobjs\tCtl\n"); 600 600 for (cur = slab_cache_list.next;cur!=&slab_cache_list; cur=cur->next) { 601 601 cache = list_get_instance(cur, slab_cache_t, link); 602 printf("%s\t%d\t%d\t%d\t%d\t%d\ n", cache->name, cache->size,603 cache->order, cache->objects,602 printf("%s\t%d\t%d\t%d\t%d\t%d\t\t%s\n", cache->name, cache->size, 603 (1 << cache->order), cache->objects, 604 604 atomic_get(&cache->allocated_slabs), 605 atomic_get(&cache->allocated_objs)); 605 atomic_get(&cache->allocated_objs), 606 cache->flags & SLAB_CACHE_SLINSIDE ? "In" : "Out"); 606 607 } 607 608 spinlock_unlock(&slab_cache_lock);
Note:
See TracChangeset
for help on using the changeset viewer.