include/drm/drm_mm.h
Source file repositories/reference/linux-study-clean/include/drm/drm_mm.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/drm_mm.h- Extension
.h- Size
- 17867 bytes
- Lines
- 553
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bug.hlinux/rbtree.hlinux/limits.hlinux/mm_types.hlinux/list.hlinux/spinlock.hlinux/stackdepot.hlinux/types.h
Detected Declarations
struct drm_printerstruct drm_mm_nodestruct drm_mmstruct drm_mm_scanenum drm_mm_insert_modefunction drm_mm_node_allocatedfunction drm_mm_initializedfunction drm_mm_hole_node_endfunction __drm_mm_hole_node_startfunction drm_mm_hole_followsfunction __drm_mm_hole_node_endfunction drm_mm_hole_followsfunction drm_mm_insert_node_in_rangefunction drm_mm_insert_node_genericfunction drm_mm_cleanfunction drm_mm_scan_init_with_range
Annotated Snippet
struct drm_mm_node {
/** @color: Opaque driver-private tag. */
unsigned long color;
/** @start: Start address of the allocated block. */
u64 start;
/** @size: Size of the allocated block. */
u64 size;
/* private: */
struct drm_mm *mm;
struct list_head node_list;
struct list_head hole_stack;
struct rb_node rb;
struct rb_node rb_hole_size;
struct rb_node rb_hole_addr;
u64 __subtree_last;
u64 hole_size;
u64 subtree_max_hole;
unsigned long flags;
#define DRM_MM_NODE_ALLOCATED_BIT 0
#define DRM_MM_NODE_SCANNED_BIT 1
#ifdef CONFIG_DRM_DEBUG_MM
depot_stack_handle_t stack;
#endif
};
/**
* struct drm_mm - DRM allocator
*
* DRM range allocator with a few special functions and features geared towards
* managing GPU memory. Except for the @color_adjust callback the structure is
* entirely opaque and should only be accessed through the provided functions
* and macros. This structure can be embedded into larger driver structures.
*/
struct drm_mm {
/**
* @color_adjust:
*
* Optional driver callback to further apply restrictions on a hole. The
* node argument points at the node containing the hole from which the
* block would be allocated (see drm_mm_hole_follows() and friends). The
* other arguments are the size of the block to be allocated. The driver
* can adjust the start and end as needed to e.g. insert guard pages.
*/
void (*color_adjust)(const struct drm_mm_node *node,
unsigned long color,
u64 *start, u64 *end);
/* private: */
/* List of all memory nodes that immediately precede a free hole. */
struct list_head hole_stack;
/* head_node.node_list is the list of all memory nodes, ordered
* according to the (increasing) start address of the memory node. */
struct drm_mm_node head_node;
/* Keep an interval_tree for fast lookup of drm_mm_nodes by address. */
struct rb_root_cached interval_tree;
struct rb_root_cached holes_size;
struct rb_root holes_addr;
unsigned long scan_active;
};
/**
* struct drm_mm_scan - DRM allocator eviction roaster data
*
* This structure tracks data needed for the eviction roaster set up using
* drm_mm_scan_init(), and used with drm_mm_scan_add_block() and
* drm_mm_scan_remove_block(). The structure is entirely opaque and should only
* be accessed through the provided functions and macros. It is meant to be
* allocated temporarily by the driver on the stack.
*/
struct drm_mm_scan {
/* private: */
struct drm_mm *mm;
u64 size;
u64 alignment;
u64 remainder_mask;
u64 range_start;
u64 range_end;
u64 hit_start;
u64 hit_end;
unsigned long color;
enum drm_mm_insert_mode mode;
};
/**
* drm_mm_node_allocated - checks whether a node is allocated
Annotation
- Immediate include surface: `linux/bug.h`, `linux/rbtree.h`, `linux/limits.h`, `linux/mm_types.h`, `linux/list.h`, `linux/spinlock.h`, `linux/stackdepot.h`, `linux/types.h`.
- Detected declarations: `struct drm_printer`, `struct drm_mm_node`, `struct drm_mm`, `struct drm_mm_scan`, `enum drm_mm_insert_mode`, `function drm_mm_node_allocated`, `function drm_mm_initialized`, `function drm_mm_hole_node_end`, `function __drm_mm_hole_node_start`, `function drm_mm_hole_follows`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source 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.