Lines Matching refs:sl

129 static inline void MAPPING_SEARCH(unsigned long *r, int *fl, int *sl)  in MAPPING_SEARCH()  argument
136 *sl = *r / (SMALL_BLOCK / MAX_SLI); in MAPPING_SEARCH()
143 *sl = (*r >> (*fl - MAX_LOG2_SLI)) - MAX_SLI; in MAPPING_SEARCH()
157 static inline void MAPPING_INSERT(unsigned long r, int *fl, int *sl) in MAPPING_INSERT() argument
162 *sl = r / (SMALL_BLOCK / MAX_SLI); in MAPPING_INSERT()
167 *sl = (r >> (*fl - MAX_LOG2_SLI)) - MAX_SLI; in MAPPING_INSERT()
177 int *sl) in FIND_SUITABLE_BLOCK() argument
179 u32 tmp = p->sl_bitmap[*fl] & (~0u << *sl); in FIND_SUITABLE_BLOCK()
184 *sl = ffs(tmp) - 1; in FIND_SUITABLE_BLOCK()
185 b = p->matrix[*fl][*sl]; in FIND_SUITABLE_BLOCK()
192 *sl = ffs(p->sl_bitmap[*fl]) - 1; in FIND_SUITABLE_BLOCK()
193 b = p->matrix[*fl][*sl]; in FIND_SUITABLE_BLOCK()
204 int sl) in EXTRACT_BLOCK_HDR() argument
206 p->matrix[fl][sl] = b->ptr.free_ptr.next; in EXTRACT_BLOCK_HDR()
207 if ( p->matrix[fl][sl] ) in EXTRACT_BLOCK_HDR()
209 p->matrix[fl][sl]->ptr.free_ptr.prev = NULL; in EXTRACT_BLOCK_HDR()
213 clear_bit(sl, &p->sl_bitmap[fl]); in EXTRACT_BLOCK_HDR()
224 int sl) in EXTRACT_BLOCK() argument
232 if ( p->matrix[fl][sl] == b ) in EXTRACT_BLOCK()
234 p->matrix[fl][sl] = b->ptr.free_ptr.next; in EXTRACT_BLOCK()
235 if ( !p->matrix[fl][sl] ) in EXTRACT_BLOCK()
237 clear_bit(sl, &p->sl_bitmap[fl]); in EXTRACT_BLOCK()
248 static inline void INSERT_BLOCK(struct bhdr *b, struct xmem_pool *p, int fl, int sl) in INSERT_BLOCK() argument
250 b->ptr.free_ptr = (struct free_ptr) {NULL, p->matrix[fl][sl]}; in INSERT_BLOCK()
251 if ( p->matrix[fl][sl] ) in INSERT_BLOCK()
252 p->matrix[fl][sl]->ptr.free_ptr.prev = b; in INSERT_BLOCK()
253 p->matrix[fl][sl] = b; in INSERT_BLOCK()
254 set_bit(sl, &p->sl_bitmap[fl]); in INSERT_BLOCK()
265 int fl, sl; in ADD_REGION() local
272 MAPPING_INSERT(b->size & BLOCK_SIZE_MASK, &fl, &sl); in ADD_REGION()
273 INSERT_BLOCK(b, pool, fl, sl); in ADD_REGION()
380 int fl, sl; in xmem_pool_alloc() local
396 MAPPING_SEARCH(&size, &fl, &sl); in xmem_pool_alloc()
399 if ( !(b = FIND_SUITABLE_BLOCK(pool, &fl, &sl)) ) in xmem_pool_alloc()
415 EXTRACT_BLOCK_HDR(b, pool, fl, sl); in xmem_pool_alloc()
431 MAPPING_INSERT(tmp_size, &fl, &sl); in xmem_pool_alloc()
432 INSERT_BLOCK(b2, pool, fl, sl); in xmem_pool_alloc()
458 int fl = 0, sl = 0; in xmem_pool_free() local
472 MAPPING_INSERT(tmp_b->size & BLOCK_SIZE_MASK, &fl, &sl); in xmem_pool_free()
473 EXTRACT_BLOCK(tmp_b, pool, fl, sl); in xmem_pool_free()
479 MAPPING_INSERT(tmp_b->size & BLOCK_SIZE_MASK, &fl, &sl); in xmem_pool_free()
480 EXTRACT_BLOCK(tmp_b, pool, fl, sl); in xmem_pool_free()
487 MAPPING_INSERT(b->size & BLOCK_SIZE_MASK, &fl, &sl); in xmem_pool_free()
497 INSERT_BLOCK(b, pool, fl, sl); in xmem_pool_free()