| /linux-6.15/lib/ |
| H A D | test_min_heap.c | 27 struct min_heap_test *heap, in pop_verify_heap() argument 30 int *values = heap->data; in pop_verify_heap() 36 while (heap->nr > 0) { in pop_verify_heap() 60 struct min_heap_test heap = { in test_heapify_all() local 77 heap.nr = ARRAY_SIZE(values); in test_heapify_all() 78 for (i = 0; i < heap.nr; i++) in test_heapify_all() 110 while (heap.nr < heap.size) { in test_heap_push() 146 heap.nr = 0; in test_heap_pop_push() 164 struct min_heap_test heap; in test_heap_del() local 177 min_heap_del_inline(&heap, get_random_u32() % heap.nr, &funcs, NULL); in test_heap_del() [all …]
|
| H A D | min_heap.c | 5 void __min_heap_init(min_heap_char *heap, void *data, size_t size) in __min_heap_init() argument 7 __min_heap_init_inline(heap, data, size); in __min_heap_init() 11 void *__min_heap_peek(struct min_heap_char *heap) in __min_heap_peek() argument 13 return __min_heap_peek_inline(heap); in __min_heap_peek() 17 bool __min_heap_full(min_heap_char *heap) in __min_heap_full() argument 19 return __min_heap_full_inline(heap); in __min_heap_full() 33 __min_heap_sift_up_inline(heap, elem_size, idx, func, args); in __min_heap_sift_up() 37 void __min_heapify_all(min_heap_char *heap, size_t elem_size, in __min_heapify_all() argument 40 __min_heapify_all_inline(heap, elem_size, func, args); in __min_heapify_all() 44 bool __min_heap_pop(min_heap_char *heap, size_t elem_size, in __min_heap_pop() argument [all …]
|
| /linux-6.15/drivers/gpu/drm/panthor/ |
| H A D | panthor_heap.c | 130 heap->chunk_count--; in panthor_free_heap_chunk() 184 heap->chunk_count++; in panthor_alloc_heap_chunk() 231 if (!heap) in panthor_heap_destroy_locked() 236 kfree(heap); in panthor_heap_destroy_locked() 304 heap = kzalloc(sizeof(*heap), GFP_KERNEL); in panthor_heap_create() 305 if (!heap) { in panthor_heap_create() 351 kfree(heap); in panthor_heap_create() 383 if (!heap) { in panthor_heap_return_chunk() 395 heap->chunk_count--; in panthor_heap_return_chunk() 447 if (!heap) { in panthor_heap_grow() [all …]
|
| /linux-6.15/Documentation/core-api/ |
| H A D | min_heap.rst | 96 - **heap**: A pointer to the min-heap structure to be initialized. 114 - **heap**: A pointer to the min-heap from which to retrieve the smallest 167 - **heap**: A pointer to the min-heap. 183 - **heap**: A pointer to the min-heap. 198 - **heap**: A pointer to the min-heap. 203 This macro ensures that the entire heap satisfies the heap property. It is 216 - **heap**: A pointer to the min-heap. 230 - **min_heap_full(heap)**: Checks whether the heap is full. 237 - `heap`: A pointer to the min-heap to check. 243 - **min_heap_empty(heap)**: Checks whether the heap is empty. [all …]
|
| /linux-6.15/drivers/dma-buf/ |
| H A D | dma-heap.c | 66 dmabuf = heap->ops->allocate(heap, len, fd_flags, heap_flags); in dma_heap_buffer_alloc() 83 if (!heap) { in dma_heap_open() 203 return heap->priv; in dma_heap_get_drvdata() 215 return heap->name; in dma_heap_get_name() 239 heap = kzalloc(sizeof(*heap), GFP_KERNEL); in dma_heap_add() 240 if (!heap) in dma_heap_add() 260 ret = cdev_add(&heap->heap_cdev, heap->heap_devt, 1); in dma_heap_add() 269 heap->heap_devt, in dma_heap_add() 271 heap->name); in dma_heap_add() 294 return heap; in dma_heap_add() [all …]
|
| /linux-6.15/include/linux/ |
| H A D | min_heap.h | 223 heap->nr = 0; in __min_heap_init_inline() 224 heap->size = size; in __min_heap_init_inline() 226 heap->data = data; in __min_heap_init_inline() 228 heap->data = heap->preallocated; in __min_heap_init_inline() 238 return heap->nr ? heap->data : NULL; in __min_heap_peek_inline() 249 return heap->nr == heap->size; in __min_heap_full_inline() 348 heap->nr--; in __min_heap_pop_inline() 384 if (WARN_ONCE(heap->nr >= heap->size, "Pushing on a full heap")) in __min_heap_push_inline() 388 pos = heap->nr; in __min_heap_push_inline() 390 heap->nr++; in __min_heap_push_inline() [all …]
|
| H A D | dma-heap.h | 23 struct dma_buf *(*allocate)(struct dma_heap *heap, 43 void *dma_heap_get_drvdata(struct dma_heap *heap); 45 const char *dma_heap_get_name(struct dma_heap *heap);
|
| /linux-6.15/fs/ubifs/ |
| H A D | lprops.c | 68 heap->arr[hpos] = heap->arr[ppos]; in move_up_lpt_heap() 102 heap->arr[hpos] = heap->arr[ppos]; in adjust_lpt_heap() 121 if (cpos >= heap->cnt) in adjust_lpt_heap() 133 heap->arr[hpos] = heap->arr[cpos]; in adjust_lpt_heap() 141 if (cpos >= heap->cnt) in adjust_lpt_heap() 147 heap->arr[hpos] = heap->arr[cpos]; in adjust_lpt_heap() 171 if (heap->cnt >= heap->max_cnt) { in add_to_lpt_heap() 223 heap->cnt -= 1; in remove_from_lpt_heap() 225 heap->arr[hpos] = heap->arr[heap->cnt]; in remove_from_lpt_heap() 227 adjust_lpt_heap(c, heap, heap->arr[hpos], hpos, cat); in remove_from_lpt_heap() [all …]
|
| H A D | find.c | 45 struct ubifs_lpt_heap *heap; in valuable() local 51 heap = &c->lpt_heap[cat - 1]; in valuable() 52 if (heap->cnt < heap->max_cnt) in valuable() 130 struct ubifs_lpt_heap *heap; in scan_for_dirty() local 137 lprops = heap->arr[i]; in scan_for_dirty() 292 if (heap->cnt) { in ubifs_find_dirty_leb() 293 lp = heap->arr[0]; in ubifs_find_dirty_leb() 401 struct ubifs_lpt_heap *heap; in do_find_free_space() local 423 lprops = heap->arr[i]; in do_find_free_space() 820 struct ubifs_lpt_heap *heap; in find_dirty_idx_leb() local [all …]
|
| /linux-6.15/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ |
| H A D | base.c | 258 mmu->type[mmu->type_nr].type = type | mmu->heap[heap].type; in nvkm_mmu_type() 259 mmu->type[mmu->type_nr].heap = heap; in nvkm_mmu_type() 269 mmu->heap[mmu->heap_nr].type = type; in nvkm_mmu_heap() 270 mmu->heap[mmu->heap_nr].size = size; in nvkm_mmu_heap() 282 int heap; in nvkm_mmu_host() local 285 heap = nvkm_mmu_heap(mmu, NVKM_MEM_HOST, ~0ULL); in nvkm_mmu_host() 286 nvkm_mmu_type(mmu, heap, type); in nvkm_mmu_host() 298 nvkm_mmu_type(mmu, heap, type); in nvkm_mmu_host() 323 u8 heap = NVKM_MEM_VRAM; in nvkm_mmu_vram() local 329 heap |= NVKM_MEM_COMP; in nvkm_mmu_vram() [all …]
|
| /linux-6.15/tools/include/nolibc/ |
| H A D | stdlib.h | 73 struct nolibc_heap *heap; in free() local 79 munmap(heap, heap->len); in free() 134 struct nolibc_heap *heap; in malloc() local 137 len = sizeof(*heap) + len; in malloc() 141 if (__builtin_expect(heap == MAP_FAILED, 0)) in malloc() 144 heap->len = len; in malloc() 145 return heap->user_p; in malloc() 168 struct nolibc_heap *heap; in realloc() local 176 user_p_len = heap->len - sizeof(*heap); in realloc() 189 memcpy(ret, heap->user_p, user_p_len); in realloc() [all …]
|
| /linux-6.15/drivers/gpu/drm/nouveau/include/nvkm/core/ |
| H A D | mm.h | 12 u8 heap; member 34 int nvkm_mm_init(struct nvkm_mm *, u8 heap, u32 offset, u32 length, u32 block); 36 int nvkm_mm_head(struct nvkm_mm *, u8 heap, u8 type, u32 size_max, 38 int nvkm_mm_tail(struct nvkm_mm *, u8 heap, u8 type, u32 size_max, 44 nvkm_mm_heap_size(struct nvkm_mm *mm, u8 heap) in nvkm_mm_heap_size() argument 49 if (node->heap == heap) in nvkm_mm_heap_size()
|
| /linux-6.15/Documentation/ABI/testing/ |
| H A D | sysfs-kernel-mm-cma | 6 heap name (also sometimes called CMA areas). 8 Each CMA heap subdirectory (that is, each 9 /sys/kernel/mm/cma/<cma-heap-name> directory) contains the 15 What: /sys/kernel/mm/cma/<cma-heap-name>/alloc_pages_success 21 What: /sys/kernel/mm/cma/<cma-heap-name>/alloc_pages_fail 27 What: /sys/kernel/mm/cma/<cma-heap-name>/release_pages_success 33 What: /sys/kernel/mm/cma/<cma-heap-name>/total_pages 39 What: /sys/kernel/mm/cma/<cma-heap-name>/available_pages
|
| /linux-6.15/drivers/gpu/drm/nouveau/nvkm/core/ |
| H A D | mm.c | 99 b->heap = a->heap; in region_head() 111 nvkm_mm_head(struct nvkm_mm *mm, u8 heap, u8 type, u32 size_max, u32 size_min, in nvkm_mm_head() argument 122 if (unlikely(heap != NVKM_MM_HEAP_ANY)) { in nvkm_mm_head() 123 if (this->heap != heap) in nvkm_mm_head() 175 b->heap = a->heap; in region_tail() 186 nvkm_mm_tail(struct nvkm_mm *mm, u8 heap, u8 type, u32 size_max, u32 size_min, in nvkm_mm_tail() argument 198 if (unlikely(heap != NVKM_MM_HEAP_ANY)) { in nvkm_mm_tail() 199 if (this->heap != heap) in nvkm_mm_tail() 240 nvkm_mm_init(struct nvkm_mm *mm, u8 heap, u32 offset, u32 length, u32 block) in nvkm_mm_init() argument 277 node->heap = heap; in nvkm_mm_init()
|
| /linux-6.15/drivers/md/bcache/ |
| H A D | movinggc.c | 219 ca->heap.nr = 0; in bch_moving_gc() 228 if (!min_heap_full(&ca->heap)) { in bch_moving_gc() 230 min_heap_push(&ca->heap, &b, &callbacks, NULL); in bch_moving_gc() 235 ca->heap.data[0] = b; in bch_moving_gc() 236 min_heap_sift_down(&ca->heap, 0, &callbacks, NULL); in bch_moving_gc() 241 if (ca->heap.nr) { in bch_moving_gc() 242 b = min_heap_peek(&ca->heap)[0]; in bch_moving_gc() 243 min_heap_pop(&ca->heap, &callbacks, NULL); in bch_moving_gc() 248 while (ca->heap.nr) { in bch_moving_gc() 249 b = min_heap_peek(&ca->heap)[0]; in bch_moving_gc() [all …]
|
| H A D | bset.c | 119 if (next < iter->heap.data->end && in bch_btree_iter_next_check() 1098 return !iter->heap.nr; in btree_iter_end() 1110 BUG_ON(!min_heap_push(&iter->heap, in bch_btree_iter_push() 1123 iter->heap.size = ARRAY_SIZE(iter->heap.preallocated); in __bch_btree_iter_init() 1124 iter->heap.nr = 0; in __bch_btree_iter_init() 1158 ret = iter->heap.data->k; in __bch_btree_iter_next() 1159 iter->heap.data->k = bkey_next(iter->heap.data->k); in __bch_btree_iter_next() 1161 if (iter->heap.data->k > iter->heap.data->end) { in __bch_btree_iter_next() 1163 iter->heap.data->k = iter->heap.data->end; in __bch_btree_iter_next() 1166 if (iter->heap.data->k == iter->heap.data->end) { in __bch_btree_iter_next() [all …]
|
| H A D | util.h | 34 #define init_heap(heap, _size, gfp) \ argument 37 (heap)->nr = 0; \ 38 (heap)->size = (_size); \ 39 _bytes = (heap)->size * sizeof(*(heap)->data); \ 40 (heap)->data = kvmalloc(_bytes, (gfp) & GFP_KERNEL); \ 41 (heap)->data; \ 44 #define free_heap(heap) \ argument 46 kvfree((heap)->data); \ 47 (heap)->data = NULL; \
|
| /linux-6.15/drivers/gpu/drm/nouveau/nvif/ |
| H A D | mmu.c | 35 kfree(mmu->heap); in nvif_mmu_dtor() 53 mmu->heap = NULL; in nvif_mmu_ctor() 72 mmu->heap = kmalloc_array(mmu->heap_nr, sizeof(*mmu->heap), in nvif_mmu_ctor() 76 if (ret = -ENOMEM, !mmu->heap || !mmu->type) in nvif_mmu_ctor() 92 mmu->heap[i].size = args.size; in nvif_mmu_ctor() 112 mmu->type[i].heap = args.heap; in nvif_mmu_ctor()
|
| /linux-6.15/drivers/dma-buf/heaps/ |
| H A D | Kconfig | 5 Choose this option to enable the system dmabuf heap. The system heap 12 Choose this option to enable dma-buf CMA heap. This heap is backed
|
| H A D | cma_heap.c | 27 struct dma_heap *heap; member 32 struct cma_heap *heap; member 247 struct cma_heap *cma_heap = buffer->heap; in cma_heap_dma_buf_release() 275 static struct dma_buf *cma_heap_allocate(struct dma_heap *heap, in cma_heap_allocate() argument 280 struct cma_heap *cma_heap = dma_heap_get_drvdata(heap); in cma_heap_allocate() 339 buffer->heap = cma_heap; in cma_heap_allocate() 343 exp_info.exp_name = dma_heap_get_name(heap); in cma_heap_allocate() 383 cma_heap->heap = dma_heap_add(&exp_info); in __add_cma_heap() 384 if (IS_ERR(cma_heap->heap)) { in __add_cma_heap() 385 int ret = PTR_ERR(cma_heap->heap); in __add_cma_heap()
|
| /linux-6.15/lib/zlib_deflate/ |
| H A D | deftree.c | 298 top = s->heap[SMALLEST]; \ 299 s->heap[SMALLEST] = s->heap[s->heap_len--]; \ 323 int v = s->heap[k]; in pqdownheap() 328 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { in pqdownheap() 335 s->heap[k] = s->heap[j]; k = j; in pqdownheap() 340 s->heap[k] = v; in pqdownheap() 379 n = s->heap[h]; in gen_bitlen() 420 m = s->heap[--h]; in gen_bitlen() 539 s->heap[--(s->heap_max)] = m; in build_tree() 552 s->heap[SMALLEST] = node++; in build_tree() [all …]
|
| /linux-6.15/drivers/accel/amdxdna/ |
| H A D | aie2_ctx.c | 59 struct amdxdna_gem_obj *heap = hwctx->priv->heap; in aie2_hwctx_restart() local 69 heap->mem.userptr, heap->mem.size); in aie2_hwctx_restart() 532 struct amdxdna_gem_obj *heap; in aie2_hwctx_init() local 542 heap = client->dev_heap; in aie2_hwctx_init() 543 if (!heap) { in aie2_hwctx_init() 549 drm_gem_object_get(to_gobj(heap)); in aie2_hwctx_init() 551 priv->heap = heap; in aie2_hwctx_init() 554 ret = amdxdna_gem_pin(heap); in aie2_hwctx_init() 613 heap->mem.userptr, heap->mem.size); in aie2_hwctx_init() 648 amdxdna_gem_unpin(heap); in aie2_hwctx_init() [all …]
|
| /linux-6.15/Documentation/userspace-api/ |
| H A D | dma-buf-heaps.rst | 14 A heap represents a specific allocator. The Linux kernel currently supports the 17 - The ``system`` heap allocates virtually contiguous, cacheable, buffers. 19 - The ``cma`` heap allocates physically contiguous, cacheable,
|
| /linux-6.15/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/ |
| H A D | nv04.c | 32 struct nvkm_mm heap; member 104 nvkm_mm_free(&iobj->imem->heap, &iobj->node); in nv04_instobj_dtor() 137 ret = nvkm_mm_head(&imem->heap, 0, 1, size, size, align ? align : 1, &iobj->node); in nv04_instobj_new() 210 ret = nvkm_mm_init(&imem->heap, 0, 0, imem->base.reserved, 1); in nv04_instmem_oneinit() 248 nvkm_mm_fini(&imem->heap); in nv04_instmem_dtor()
|
| H A D | nv40.c | 32 struct nvkm_mm heap; member 103 nvkm_mm_free(&iobj->imem->heap, &iobj->node); in nv40_instobj_dtor() 136 ret = nvkm_mm_head(&imem->heap, 0, 1, size, size, align ? align : 1, &iobj->node); in nv40_instobj_new() 179 ret = nvkm_mm_init(&imem->heap, 0, 0, imem->base.reserved, 1); in nv40_instmem_oneinit() 221 nvkm_mm_fini(&imem->heap); in nv40_instmem_dtor()
|