Changeset 4a5b2b0e in mainline for generic/src/mm/slab.c
- Timestamp:
- 2006-02-02T22:38:13Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 086a600
- Parents:
- 14e5d88
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/mm/slab.c
r14e5d88 r4a5b2b0e 97 97 slab->available = cache->objects; 98 98 slab->nextavail = 0; 99 slab->cache = cache; 99 100 100 101 for (i=0; i<cache->objects;i++) … … 151 152 if (!slab) 152 153 slab = obj2slab(obj); 154 155 ASSERT(slab->cache == cache); 153 156 154 157 *((int *)obj) = slab->nextavail; … … 231 234 count_t frames = 0; 232 235 233 for (i=0;i < mag->busy; i++) 236 for (i=0;i < mag->busy; i++) { 234 237 frames += slab_obj_destroy(cache, mag->objs[i], NULL); 238 atomic_dec(&cache->cached_objs); 239 } 235 240 236 241 slab_free(&mag_cache, mag); … … 247 252 { 248 253 slab_magazine_t *mag; 254 void *obj; 249 255 250 256 spinlock_lock(&cache->mag_cache[CPU->id].lock); … … 280 286 } 281 287 gotit: 288 obj = mag->objs[--mag->busy]; 282 289 spinlock_unlock(&cache->mag_cache[CPU->id].lock); 283 return mag->objs[--mag->busy]; 290 atomic_dec(&cache->cached_objs); 291 292 return obj; 284 293 out: 285 294 spinlock_unlock(&cache->mag_cache[CPU->id].lock); … … 338 347 339 348 spinlock_unlock(&cache->mag_cache[CPU->id].lock); 349 atomic_inc(&cache->cached_objs); 340 350 return 0; 341 351 errout: … … 468 478 if (flags & SLAB_RECLAIM_ALL) { 469 479 /* Aggressive memfree */ 470 471 480 /* Destroy CPU magazines */ 472 481 for (i=0; i<config.cpu_count; i++) { … … 484 493 /* Destroy full magazines */ 485 494 cur=cache->magazines.prev; 495 486 496 while (cur!=&cache->magazines) { 487 497 mag = list_get_instance(cur, slab_magazine_t, link); … … 489 499 cur = cur->prev; 490 500 list_remove(cur->next); 501 // list_remove(&mag->link); 491 502 frames += magazine_destroy(cache,mag); 492 503 /* If we do not do full reclaim, break … … 597 608 598 609 spinlock_lock(&slab_cache_lock); 599 printf("SLAB name\tOsize\tPages\tO cnt\tSlabs\tAllocobjs\tCtl\n");610 printf("SLAB name\tOsize\tPages\tObj/pg\tSlabs\tCached\tAllocobjs\tCtl\n"); 600 611 for (cur = slab_cache_list.next;cur!=&slab_cache_list; cur=cur->next) { 601 612 cache = list_get_instance(cur, slab_cache_t, link); 602 printf("%s\t%d\t%d\t%d\t%d\t%d\t \t%s\n", cache->name, cache->size,613 printf("%s\t%d\t%d\t%d\t%d\t%d\t%d\t\t%s\n", cache->name, cache->size, 603 614 (1 << cache->order), cache->objects, 604 atomic_get(&cache->allocated_slabs), 615 atomic_get(&cache->allocated_slabs), 616 atomic_get(&cache->cached_objs), 605 617 atomic_get(&cache->allocated_objs), 606 618 cache->flags & SLAB_CACHE_SLINSIDE ? "In" : "Out");
Note:
See TracChangeset
for help on using the changeset viewer.