Browse code

core/mem: ll_malloc initialization updated to be able to set pool type

Daniel-Constantin Mierla authored on 03/05/2014 18:05:12
Showing 2 changed files
... ...
@@ -356,7 +356,7 @@ void sfm_split_frag(struct sfm_block* qm, struct sfm_frag* frag,
356 356
 
357 357
 
358 358
 /* init malloc and return a sfm_block*/
359
-struct sfm_block* sfm_malloc_init(char* address, unsigned long size)
359
+struct sfm_block* sfm_malloc_init(char* address, unsigned long size, int type)
360 360
 {
361 361
 	char* start;
362 362
 	char* end;
... ...
@@ -392,6 +392,7 @@ struct sfm_block* sfm_malloc_init(char* address, unsigned long size)
392 392
 	qm=(struct sfm_block*)start;
393 393
 	memset(qm, 0, sizeof(struct sfm_block));
394 394
 	qm->size=size;
395
+	qm->type = type;
395 396
 	size-=init_overhead;
396 397
 	
397 398
 	qm->first_frag=(struct sfm_frag*)(start+ROUNDUP(sizeof(struct sfm_block)));
... ...
@@ -131,6 +131,7 @@ struct sfm_block{
131 131
 	gen_lock_t lock;
132 132
 #endif
133 133
 	atomic_t crt_id; /* current pool */
134
+	int type; /* type of pool */
134 135
 	unsigned long size; /* total size */
135 136
 	/* stats are kept now per bucket */
136 137
 	struct sfm_frag* first_frag;
... ...
@@ -145,7 +146,7 @@ struct sfm_block{
145 145
 
146 146
 
147 147
 
148
-struct sfm_block* sfm_malloc_init(char* address, unsigned long size);
148
+struct sfm_block* sfm_malloc_init(char* address, unsigned long size, int type);
149 149
 void sfm_malloc_destroy(struct sfm_block* qm);
150 150
 int sfm_pool_reset();
151 151