Changeset 6c441cf8 in mainline for kernel/generic/src/mm/slab.c
- Timestamp:
- 2008-02-27T11:49:17Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 56976a17
- Parents:
- fdb7795
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/slab.c
rfdb7795 r6c441cf8 173 173 slab_t *slab; 174 174 size_t fsize; 175 int i;175 unsigned int i; 176 176 unsigned int zone = 0; 177 177 … … 192 192 193 193 /* Fill in slab structures */ 194 for (i =0; i < (1 << cache->order); i++)195 frame_set_parent(ADDR2PFN(KA2PA(data)) +i, slab, zone);194 for (i = 0; i < ((unsigned int) 1 << cache->order); i++) 195 frame_set_parent(ADDR2PFN(KA2PA(data)) + i, slab, zone); 196 196 197 197 slab->start = data; … … 200 200 slab->cache = cache; 201 201 202 for (i =0; i<cache->objects;i++)202 for (i = 0; i < cache->objects; i++) 203 203 *((int *) (slab->start + i*cache->size)) = i+1; 204 204 … … 372 372 slab_magazine_t *mag) 373 373 { 374 int i;374 unsigned int i; 375 375 count_t frames = 0; 376 376 377 for (i =0;i < mag->busy; i++) {377 for (i = 0; i < mag->busy; i++) { 378 378 frames += slab_obj_destroy(cache, mag->objs[i], NULL); 379 379 atomic_dec(&cache->cached_objs); … … 528 528 529 529 /** Return number of objects that fit in certain cache size */ 530 static int comp_objects(slab_cache_t *cache)530 static unsigned int comp_objects(slab_cache_t *cache) 531 531 { 532 532 if (cache->flags & SLAB_CACHE_SLINSIDE) … … 537 537 538 538 /** Return wasted space in slab */ 539 static int badness(slab_cache_t *cache)540 { 541 int objects;542 int ssize;539 static unsigned int badness(slab_cache_t *cache) 540 { 541 unsigned int objects; 542 unsigned int ssize; 543 543 544 544 objects = comp_objects(cache); … … 546 546 if (cache->flags & SLAB_CACHE_SLINSIDE) 547 547 ssize -= sizeof(slab_t); 548 return ssize - objects *cache->size;548 return ssize - objects * cache->size; 549 549 } 550 550 … … 554 554 static void make_magcache(slab_cache_t *cache) 555 555 { 556 int i;556 unsigned int i; 557 557 558 558 ASSERT(_slab_initialized >= 2); 559 559 560 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 562 memsetb((uintptr_t)&cache->mag_cache[i], 563 563 sizeof(cache->mag_cache[i]), 0); 564 spinlock_initialize(&cache->mag_cache[i].lock, 565 "slab_maglock_cpu"); 564 spinlock_initialize(&cache->mag_cache[i].lock, "slab_maglock_cpu"); 566 565 } 567 566 } … … 655 654 static count_t _slab_reclaim(slab_cache_t *cache, int flags) 656 655 { 657 int i;656 unsigned int i; 658 657 slab_magazine_t *mag; 659 658 count_t frames = 0; … … 676 675 /* Free cpu-bound magazines */ 677 676 /* Destroy CPU magazines */ 678 for (i =0; i<config.cpu_count; i++) {677 for (i = 0; i < config.cpu_count; i++) { 679 678 spinlock_lock(&cache->mag_cache[i].lock); 680 679
Note:
See TracChangeset
for help on using the changeset viewer.