| /linux/Documentation/core-api/ |
| H A D | min_heap.rst | 13 in the Linux kernel. A min-heap is a binary tree structure where the value of 39 The core data structure for representing a min-heap is defined using the 41 you to define a min-heap with a preallocated buffer or dynamically allocated 50 size_t nr; /* Number of elements in the heap */ 52 _type *data; /* Pointer to the heap data */ 58 A typical heap structure will include a counter for the number of elements 59 (`nr`), the maximum capacity of the heap (`size`), and a pointer to an array of 61 heap storage using **MIN_HEAP_PREALLOCATED**. 67 elements in the heap and swapping them. It contains two function pointers: 77 - **swp** is a function for swapping elements in the heap. If swp is set to [all …]
|
| /linux/drivers/dma-buf/ |
| H A D | dma-heap.c | 61 struct dma_heap *heap; in dma_heap_open() local 63 heap = xa_load(&dma_heap_minors, iminor(inode)); in dma_heap_open() 64 if (!heap) { in dma_heap_open() 70 file->private_data = heap; in dma_heap_open() 79 struct dma_heap *heap = file->private_data; in dma_heap_ioctl_allocate() local 97 dmabuf = heap->ops->allocate(heap, len, heap_allocation->fd_flags, in dma_heap_ioctl_allocate() 209 void *dma_heap_get_drvdata(struct dma_heap *heap) in dma_heap_get_drvdata() argument 211 return heap->priv; in dma_heap_get_drvdata() 222 const char *dma_heap_get_name(struct dma_heap *heap) in dma_heap_get_name() argument 224 return heap->name; in dma_heap_get_name() [all …]
|
| /linux/fs/ubifs/ |
| H A D | lprops.c | 50 static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in move_up_lpt_heap() argument 63 val2 = get_heap_comp_val(heap->arr[ppos], cat); in move_up_lpt_heap() 67 heap->arr[ppos]->hpos = hpos; in move_up_lpt_heap() 68 heap->arr[hpos] = heap->arr[ppos]; in move_up_lpt_heap() 69 heap->arr[ppos] = lprops; in move_up_lpt_heap() 87 static void adjust_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in adjust_lpt_heap() argument 97 val2 = get_heap_comp_val(heap->arr[ppos], cat); in adjust_lpt_heap() 101 heap->arr[ppos]->hpos = hpos; in adjust_lpt_heap() 102 heap->arr[hpos] = heap->arr[ppos]; in adjust_lpt_heap() 103 heap->arr[ppos] = lprops; in adjust_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 135 heap = &c->lpt_heap[LPROPS_FREE - 1]; in scan_for_dirty() 136 for (i = 0; i < heap->cnt; i++) { in scan_for_dirty() 137 lprops = heap->arr[i]; in scan_for_dirty() 226 struct ubifs_lpt_heap *heap, *idx_heap; in ubifs_find_dirty_leb() local 272 heap = &c->lpt_heap[LPROPS_DIRTY - 1]; in ubifs_find_dirty_leb() 292 if (heap->cnt) { in ubifs_find_dirty_leb() [all …]
|
| /linux/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ |
| H A D | base.c | 255 nvkm_mmu_type(struct nvkm_mmu *mmu, int heap, u8 type) in nvkm_mmu_type() argument 257 if (heap >= 0 && !WARN_ON(mmu->type_nr == ARRAY_SIZE(mmu->type))) { in nvkm_mmu_type() 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() 268 if (!WARN_ON(mmu->heap_nr == ARRAY_SIZE(mmu->heap))) { in nvkm_mmu_heap() 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() [all …]
|
| /linux/tools/include/nolibc/ |
| H A D | stdlib.h | 94 struct nolibc_heap *heap; in free() local 99 heap = container_of(ptr, struct nolibc_heap, user_p); in free() 100 munmap(heap, heap->len); in free() 131 struct nolibc_heap *heap; in malloc() local 133 if (__builtin_expect(__builtin_add_overflow(len, sizeof(*heap), &len), 0)) { in malloc() 138 heap = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, in malloc() 140 if (__builtin_expect(heap == MAP_FAILED, 0)) in malloc() 143 heap->len = len; in malloc() 144 return heap->user_p; in malloc() 167 struct nolibc_heap *heap; in realloc() local [all …]
|
| /linux/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/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()
|
| H A D | gpuobj.c | 180 ret = nvkm_mm_head(&parent->heap, 0, 1, size, size, in nvkm_gpuobj_ctor() 183 ret = nvkm_mm_tail(&parent->heap, 0, 1, size, size, in nvkm_gpuobj_ctor() 211 return nvkm_mm_init(&gpuobj->heap, 0, 0, gpuobj->size, 1); in nvkm_gpuobj_ctor() 220 nvkm_mm_free(&gpuobj->parent->heap, &gpuobj->node); in nvkm_gpuobj_del() 221 nvkm_mm_fini(&gpuobj->heap); in nvkm_gpuobj_del()
|
| /linux/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 ``system_cc_shared`` heap allocates virtually contiguous, cacheable, 24 support. On non-CoCo VM configurations, this heap is not registered. 26 - The ``default_cma_region`` heap allocates physically contiguous, 36 - A heap will be created for each reusable region in the device tree 50 - The name must describe the memory region the heap will allocate from, and 52 use the heap name as the discriminant, it must be able to tell which heap it 56 heap driver will change over time, and implementation details when it was 60 Doing so will make heap identification easier for userspace. Such properties [all …]
|
| /linux/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_objs(*mmu->heap, mmu->heap_nr); in nvif_mmu_ctor() 74 if (ret = -ENOMEM, !mmu->heap || !mmu->type) in nvif_mmu_ctor() 89 mmu->heap[i].size = args.size; in nvif_mmu_ctor() 109 mmu->type[i].heap = args.heap; in nvif_mmu_ctor()
|
| /linux/drivers/tee/ |
| H A D | tee_heap.c | 18 struct dma_heap *heap; member 29 struct tee_dma_heap *heap; member 153 buf->heap->pool->ops->free(buf->heap->pool, &buf->table); in tee_heap_buf_free() 154 mutex_lock(&buf->heap->mu); in tee_heap_buf_free() 155 put_tee_heap(buf->heap); in tee_heap_buf_free() 156 mutex_unlock(&buf->heap->mu); in tee_heap_buf_free() 168 static struct dma_buf *tee_dma_heap_alloc(struct dma_heap *heap, in tee_dma_heap_alloc() argument 172 struct tee_dma_heap *h = dma_heap_get_drvdata(heap); in tee_dma_heap_alloc() 197 buf->heap = h; in tee_dma_heap_alloc() 273 h->heap = dma_heap_add(&exp_info); in alloc_dma_heap() [all …]
|
| /linux/drivers/accel/amdxdna/ |
| H A D | amdxdna_gem.c | 29 * The dev BO could be across multiple heap BO chunks. The heap chunks should 38 struct amdxdna_gem_obj *heap; in amdxdna_init_dev_bo() 44 XDNA_DBG(xdna, "Empty heap xa"); in amdxdna_init_dev_bo() 49 heap = xa_load(&client->dev_heap_xa, heap_id); in amdxdna_init_dev_bo() 50 if (!heap) { in amdxdna_init_dev_bo() 51 XDNA_ERR(xdna, "Failed to load heap %d", heap_id); in amdxdna_init_dev_bo() 54 heap_addr = amdxdna_gem_dev_addr(heap); in amdxdna_init_dev_bo() 60 heap = xa_load(&client->dev_heap_xa, heap_id); in amdxdna_init_dev_bo() 61 exp_heap_uva = amdxdna_gem_uva(heap); in amdxdna_init_dev_bo() 37 struct amdxdna_gem_obj *heap; amdxdna_init_dev_bo() local 104 struct amdxdna_gem_obj *heap; amdxdna_gem_heap_alloc() local 149 struct amdxdna_gem_obj *heap; amdxdna_gem_heap_free() local 740 struct amdxdna_gem_obj *heap; amdxdna_gem_dev_obj_vmap() local 1140 struct amdxdna_gem_obj *heap; amdxdna_gem_pin_nolock() local 1179 struct amdxdna_gem_obj *heap; amdxdna_gem_unpin() local 1297 struct amdxdna_gem_obj *heap; amdxdna_drm_sync_bo_ioctl() local [all...] |
| H A D | aie2_ctx.c | 110 struct amdxdna_gem_obj *heap = hwctx->priv->heap; in aie2_hwctx_restart() 121 amdxdna_obj_dma_addr(heap), in aie2_hwctx_restart() 122 heap->mem.size); in aie2_hwctx_restart() 128 xa_for_each_range(&hwctx->client->dev_heap_xa, heap_id, heap, 1, in aie2_hwctx_restart() 131 amdxdna_obj_dma_addr(heap), in aie2_hwctx_restart() 132 heap->mem.size); in aie2_hwctx_restart() 134 XDNA_ERR(xdna, "Add heap %ld failed ret %d", heap_id, ret); in aie2_hwctx_restart() 742 struct amdxdna_gem_obj *heap; in aie2_hwctx_init() 764 heap in aie2_hwctx_init() 109 struct amdxdna_gem_obj *heap = hwctx->priv->heap; aie2_hwctx_restart() local 678 struct amdxdna_gem_obj *heap; aie2_hwctx_init() local 1230 aie2_hwctx_heap_expand(struct amdxdna_hwctx * hwctx,struct amdxdna_gem_obj * heap) aie2_hwctx_heap_expand() argument [all...] |
| H A D | amdxdna_ctx.c | 67 struct amdxdna_gem_obj *heap; in amdxdna_hwctx_release_expanded_heap() local 72 xa_for_each_range(&client->dev_heap_xa, heap_id, heap, 1, in amdxdna_hwctx_release_expanded_heap() 74 amdxdna_gem_unpin(heap); in amdxdna_hwctx_release_expanded_heap() 75 drm_gem_object_put(to_gobj(heap)); in amdxdna_hwctx_release_expanded_heap() 460 struct amdxdna_gem_obj *heap; in amdxdna_hwctx_expand_heap() local 468 xa_for_each_range(&client->dev_heap_xa, heap_id, heap, in amdxdna_hwctx_expand_heap() 470 drm_gem_object_get(to_gobj(heap)); in amdxdna_hwctx_expand_heap() 471 ret = amdxdna_gem_pin(heap); in amdxdna_hwctx_expand_heap() 473 drm_gem_object_put(to_gobj(heap)); in amdxdna_hwctx_expand_heap() 477 ret = xdna->dev_info->ops->hwctx_heap_expand(hwctx, heap); in amdxdna_hwctx_expand_heap() [all...] |
| /linux/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() 332 if (smaller(tree, v, s->heap[j], s->depth)) break; in pqdownheap() 335 s->heap[k] = s->heap[j]; k = j; in pqdownheap() 340 s->heap[k] = v; in pqdownheap() 376 tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ in gen_bitlen() 379 n = s->heap[h]; in gen_bitlen() 420 m = s->heap[--h]; in gen_bitlen() [all …]
|
| /linux/tools/perf/util/ |
| H A D | powerpc-vpadtl.c | 27 struct auxtrace_heap heap; member 366 * of perf record with timestamp of top element in the auxtrace heap. 367 * Process the auxtrace queue if the timestamp of element from heap is 370 * Update the timestamp of the auxtrace heap with the timestamp 383 if (!vpa->heap.heap_cnt) in powerpc_vpadtl_process_queues() 386 if (vpa->heap.heap_array[0].ordinal >= timestamp) in powerpc_vpadtl_process_queues() 389 queue_nr = vpa->heap.heap_array[0].queue_nr; in powerpc_vpadtl_process_queues() 393 auxtrace_heap__pop(&vpa->heap); in powerpc_vpadtl_process_queues() 395 if (vpa->heap.heap_cnt) { in powerpc_vpadtl_process_queues() 396 ts = vpa->heap in powerpc_vpadtl_process_queues() [all...] |
| H A D | s390-cpumsf.c | 171 struct auxtrace_heap heap; member 819 return auxtrace_heap__add(&sf->heap, queue_nr, ts); in s390_cpumsf_setup_queue() 855 if (!sf->heap.heap_cnt) in s390_cpumsf_process_queues() 858 if (sf->heap.heap_array[0].ordinal >= timestamp) in s390_cpumsf_process_queues() 861 queue_nr = sf->heap.heap_array[0].queue_nr; in s390_cpumsf_process_queues() 865 auxtrace_heap__pop(&sf->heap); in s390_cpumsf_process_queues() 866 if (sf->heap.heap_cnt) { in s390_cpumsf_process_queues() 867 ts = sf->heap.heap_array[0].ordinal + 1; in s390_cpumsf_process_queues() 876 auxtrace_heap__add(&sf->heap, queue_nr, ts); in s390_cpumsf_process_queues() 880 ret = auxtrace_heap__add(&sf->heap, queue_nr, ts); in s390_cpumsf_process_queues() [all …]
|
| /linux/drivers/md/bcache/ |
| H A D | util.h | 39 #define init_heap(heap, _size, gfp) \ argument 42 (heap)->used = 0; \ 43 (heap)->size = (_size); \ 44 _bytes = (heap)->size * sizeof(*(heap)->data); \ 45 (heap)->data = kvmalloc(_bytes, (gfp) & GFP_KERNEL); \ 46 (heap)->data; \ 49 #define free_heap(heap) \ argument 51 kvfree((heap)->data); \ 52 (heap)->data = NULL; \
|
| H A D | alloc.c | 178 ca->heap.used = 0; in invalidate_buckets_lru() 184 if (!heap_full(&ca->heap)) in invalidate_buckets_lru() 185 heap_add(&ca->heap, b, bucket_max_cmp); in invalidate_buckets_lru() 186 else if (bucket_max_cmp(b, heap_peek(&ca->heap))) { in invalidate_buckets_lru() 187 ca->heap.data[0] = b; in invalidate_buckets_lru() 188 heap_sift(&ca->heap, 0, bucket_max_cmp); in invalidate_buckets_lru() 192 for (i = ca->heap.used / 2 - 1; i >= 0; --i) in invalidate_buckets_lru() 193 heap_sift(&ca->heap, i, bucket_min_cmp); in invalidate_buckets_lru() 196 if (!heap_pop(&ca->heap, b, bucket_min_cmp)) { in invalidate_buckets_lru()
|
| /linux/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/ |
| 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()
|
| 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()
|
| /linux/arch/x86/boot/compressed/ |
| H A D | misc.c | 410 memptr heap = (memptr)boot_heap; in extract_kernel() local 458 free_mem_ptr = heap; /* Heap */ in extract_kernel() 459 free_mem_end_ptr = heap + BOOT_HEAP_SIZE; in extract_kernel() 501 if (heap > 0x3fffffffffffUL) in extract_kernel() 506 if (heap > ((-__PAGE_OFFSET-(128<<20)-1) & 0x7fffffff)) in extract_kernel()
|
| /linux/arch/mips/boot/compressed/ |
| H A D | head.S | 32 PTR_LA a0, (.heap) /* heap address */ 51 .comm .heap,BOOT_HEAP_SIZE,4
|
| /linux/drivers/gpu/drm/nouveau/include/nvif/ |
| H A D | mmu.h | 16 } *heap; member 28 u8 heap; member
|