• Home
  • Raw
  • Download

Lines Matching refs:chunk

38 static inline size_t chunk_size(const struct gen_pool_chunk *chunk)  in chunk_size()  argument
40 return chunk->end_addr - chunk->start_addr + 1; in chunk_size()
185 struct gen_pool_chunk *chunk; in gen_pool_add_owner() local
190 chunk = vzalloc_node(nbytes, nid); in gen_pool_add_owner()
191 if (unlikely(chunk == NULL)) in gen_pool_add_owner()
194 chunk->phys_addr = phys; in gen_pool_add_owner()
195 chunk->start_addr = virt; in gen_pool_add_owner()
196 chunk->end_addr = virt + size - 1; in gen_pool_add_owner()
197 chunk->owner = owner; in gen_pool_add_owner()
198 atomic_long_set(&chunk->avail, size); in gen_pool_add_owner()
201 list_add_rcu(&chunk->next_chunk, &pool->chunks); in gen_pool_add_owner()
217 struct gen_pool_chunk *chunk; in gen_pool_virt_to_phys() local
221 list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) { in gen_pool_virt_to_phys()
222 if (addr >= chunk->start_addr && addr <= chunk->end_addr) { in gen_pool_virt_to_phys()
223 paddr = chunk->phys_addr + (addr - chunk->start_addr); in gen_pool_virt_to_phys()
243 struct gen_pool_chunk *chunk; in gen_pool_destroy() local
248 chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk); in gen_pool_destroy()
249 list_del(&chunk->next_chunk); in gen_pool_destroy()
251 end_bit = chunk_size(chunk) >> order; in gen_pool_destroy()
252 bit = find_next_bit(chunk->bits, end_bit, 0); in gen_pool_destroy()
255 vfree(chunk); in gen_pool_destroy()
278 struct gen_pool_chunk *chunk; in gen_pool_alloc_algo_owner() local
295 list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) { in gen_pool_alloc_algo_owner()
296 if (size > atomic_long_read(&chunk->avail)) in gen_pool_alloc_algo_owner()
300 end_bit = chunk_size(chunk) >> order; in gen_pool_alloc_algo_owner()
302 start_bit = algo(chunk->bits, end_bit, start_bit, in gen_pool_alloc_algo_owner()
303 nbits, data, pool, chunk->start_addr); in gen_pool_alloc_algo_owner()
306 remain = bitmap_set_ll(chunk->bits, start_bit, nbits); in gen_pool_alloc_algo_owner()
308 remain = bitmap_clear_ll(chunk->bits, start_bit, in gen_pool_alloc_algo_owner()
314 addr = chunk->start_addr + ((unsigned long)start_bit << order); in gen_pool_alloc_algo_owner()
316 atomic_long_sub(size, &chunk->avail); in gen_pool_alloc_algo_owner()
318 *owner = chunk->owner; in gen_pool_alloc_algo_owner()
488 struct gen_pool_chunk *chunk; in gen_pool_free_owner() local
501 list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) { in gen_pool_free_owner()
502 if (addr >= chunk->start_addr && addr <= chunk->end_addr) { in gen_pool_free_owner()
503 BUG_ON(addr + size - 1 > chunk->end_addr); in gen_pool_free_owner()
504 start_bit = (addr - chunk->start_addr) >> order; in gen_pool_free_owner()
505 remain = bitmap_clear_ll(chunk->bits, start_bit, nbits); in gen_pool_free_owner()
508 atomic_long_add(size, &chunk->avail); in gen_pool_free_owner()
510 *owner = chunk->owner; in gen_pool_free_owner()
530 void (*func)(struct gen_pool *pool, struct gen_pool_chunk *chunk, void *data), in gen_pool_for_each_chunk() argument
533 struct gen_pool_chunk *chunk; in gen_pool_for_each_chunk() local
536 list_for_each_entry_rcu(chunk, &(pool)->chunks, next_chunk) in gen_pool_for_each_chunk()
537 func(pool, chunk, data); in gen_pool_for_each_chunk()
556 struct gen_pool_chunk *chunk; in addr_in_gen_pool() local
559 list_for_each_entry_rcu(chunk, &(pool)->chunks, next_chunk) { in addr_in_gen_pool()
560 if (start >= chunk->start_addr && start <= chunk->end_addr) { in addr_in_gen_pool()
561 if (end <= chunk->end_addr) { in addr_in_gen_pool()
579 struct gen_pool_chunk *chunk; in gen_pool_avail() local
583 list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) in gen_pool_avail()
584 avail += atomic_long_read(&chunk->avail); in gen_pool_avail()
598 struct gen_pool_chunk *chunk; in gen_pool_size() local
602 list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) in gen_pool_size()
603 size += chunk_size(chunk); in gen_pool_size()