Changeset c3ebc47 in mainline for kernel/generic/include/mm/slab.h
- Timestamp:
- 2009-03-24T03:06:21Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 21a639b7
- Parents:
- 05641a9e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/mm/slab.h
r05641a9e rc3ebc47 42 42 43 43 /** Minimum size to be allocated by malloc */ 44 #define SLAB_MIN_MALLOC_W 444 #define SLAB_MIN_MALLOC_W 4 45 45 46 46 /** Maximum size to be allocated by malloc */ 47 #define SLAB_MAX_MALLOC_W 1847 #define SLAB_MAX_MALLOC_W 22 48 48 49 49 /** Initial Magazine size (TODO: dynamically growing magazines) */ … … 51 51 52 52 /** If object size is less, store control structure inside SLAB */ 53 #define SLAB_INSIDE_SIZE 53 #define SLAB_INSIDE_SIZE (PAGE_SIZE >> 3) 54 54 55 55 /** Maximum wasted space we allow for cache */ 56 #define SLAB_MAX_BADNESS(cache) 56 #define SLAB_MAX_BADNESS(cache) \ 57 57 (((unsigned int) PAGE_SIZE << (cache)->order) >> 2) 58 58 … … 65 65 66 66 /** Do not use per-cpu cache */ 67 #define SLAB_CACHE_NOMAGAZINE 0x167 #define SLAB_CACHE_NOMAGAZINE 0x01 68 68 /** Have control structure inside SLAB */ 69 #define SLAB_CACHE_SLINSIDE 0x269 #define SLAB_CACHE_SLINSIDE 0x02 70 70 /** We add magazine cache later, if we have this flag */ 71 #define SLAB_CACHE_MAGDEFERRED (0x4 | SLAB_CACHE_NOMAGAZINE)71 #define SLAB_CACHE_MAGDEFERRED (0x04 | SLAB_CACHE_NOMAGAZINE) 72 72 73 73 typedef struct { 74 74 link_t link; 75 count_t busy; 76 count_t size; 77 void *objs[]; 75 count_t busy; /**< Count of full slots in magazine */ 76 count_t size; /**< Number of slots in magazine */ 77 void *objs[]; /**< Slots in magazine */ 78 78 } slab_magazine_t; 79 79 … … 87 87 typedef struct { 88 88 char *name; 89 89 90 90 link_t link; 91 91 92 92 /* Configuration */ 93 93 /** Size of slab position - align_up(sizeof(obj)) */ 94 94 size_t size; 95 95 96 96 int (*constructor)(void *obj, int kmflag); 97 97 int (*destructor)(void *obj); 98 98 99 99 /** Flags changing behaviour of cache */ 100 100 int flags; 101 101 102 102 /* Computed values */ 103 uint8_t order; 104 unsigned int objects; 105 103 uint8_t order; /**< Order of frames to be allocated */ 104 unsigned int objects; /**< Number of objects that fit in */ 105 106 106 /* Statistics */ 107 107 atomic_t allocated_slabs; … … 110 110 /** How many magazines in magazines list */ 111 111 atomic_t magazine_counter; 112 112 113 113 /* Slabs */ 114 link_t full_slabs; 115 link_t partial_slabs; 114 link_t full_slabs; /**< List of full slabs */ 115 link_t partial_slabs; /**< List of partial slabs */ 116 116 SPINLOCK_DECLARE(slablock); 117 /* Magazines 118 link_t magazines; 117 /* Magazines */ 118 link_t magazines; /**< List o full magazines */ 119 119 SPINLOCK_DECLARE(maglock); 120 120 121 121 /** CPU cache */ 122 122 slab_mag_cache_t *mag_cache; … … 142 142 extern void *realloc(void *, unsigned int, int); 143 143 extern void free(void *); 144 144 145 #endif 145 146
Note:
See TracChangeset
for help on using the changeset viewer.