Changeset 41deb2a in mainline
- Timestamp:
- 2011-12-30T19:27:15Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- efb48eb
- Parents:
- 0fd9b35
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/lib/ra.h
r0fd9b35 r41deb2a 77 77 } ra_segment_t; 78 78 79 extern void ra_init(void); 79 80 extern ra_arena_t *ra_arena_create(void); 80 81 extern bool ra_span_add(ra_arena_t *, uintptr_t, size_t); -
kernel/generic/src/lib/ra.c
r0fd9b35 r41deb2a 55 55 #include <synch/spinlock.h> 56 56 57 static slab_cache_t *ra_segment_cache; 58 57 59 #define USED_BUCKETS 1024 58 60 … … 90 92 ra_segment_t *seg; 91 93 92 seg = (ra_segment_t *) malloc(sizeof(ra_segment_t), FRAME_ATOMIC);94 seg = slab_alloc(ra_segment_cache, FRAME_ATOMIC); 93 95 if (!seg) 94 96 return NULL; … … 105 107 static void ra_segment_destroy(ra_segment_t *seg) 106 108 { 107 free(seg);109 slab_free(ra_segment_cache, seg); 108 110 } 109 111 … … 420 422 } 421 423 424 void ra_init(void) 425 { 426 ra_segment_cache = slab_cache_create("segment_cache", 427 sizeof(ra_segment_t), 0, NULL, NULL, SLAB_CACHE_MAGDEFERRED); 428 } 422 429 423 430 /** @} -
kernel/generic/src/main/main.c
r0fd9b35 r41deb2a 87 87 #include <sysinfo/sysinfo.h> 88 88 #include <sysinfo/stats.h> 89 #include <lib/ra.h> 89 90 90 91 /** Global configuration structure. */ … … 212 213 km_identity_init(); 213 214 frame_init(); 214 /* Initialize at least 1 memory segment big enough for slab to work. */215 215 slab_cache_init(); 216 ra_init(); 216 217 sysinfo_init(); 217 218 btree_init();
Note:
See TracChangeset
for help on using the changeset viewer.