drivers/gpu/drm/drm_buddy.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_buddy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_buddy.c- Extension
.c- Size
- 1911 bytes
- Lines
- 79
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/test-bug.hlinux/export.hlinux/kmemleak.hlinux/module.hlinux/sizes.hlinux/gpu_buddy.hdrm/drm_buddy.hdrm/drm_print.h
Detected Declarations
function drm_buddy_block_printfunction drm_buddy_printfunction for_each_free_treefunction rbtree_postorder_for_each_entry_safeexport drm_buddy_block_printexport drm_buddy_print
Annotated Snippet
for_each_free_tree(tree) {
root = &mm->free_trees[tree][order];
rbtree_postorder_for_each_entry_safe(block, tmp, root, rb) {
BUG_ON(!gpu_buddy_block_is_free(block));
count++;
}
}
drm_printf(p, "order-%2d ", order);
free = count * (mm->chunk_size << order);
if (free < SZ_1M)
drm_printf(p, "free: %8llu KiB", free >> 10);
else
drm_printf(p, "free: %8llu MiB", free >> 20);
drm_printf(p, ", blocks: %llu\n", count);
}
}
EXPORT_SYMBOL(drm_buddy_print);
MODULE_DESCRIPTION("DRM-specific GPU Buddy Allocator Print Helpers");
MODULE_LICENSE("Dual MIT/GPL");
Annotation
- Immediate include surface: `kunit/test-bug.h`, `linux/export.h`, `linux/kmemleak.h`, `linux/module.h`, `linux/sizes.h`, `linux/gpu_buddy.h`, `drm/drm_buddy.h`, `drm/drm_print.h`.
- Detected declarations: `function drm_buddy_block_print`, `function drm_buddy_print`, `function for_each_free_tree`, `function rbtree_postorder_for_each_entry_safe`, `export drm_buddy_block_print`, `export drm_buddy_print`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.