ENUM DRM_MM_INSERT_MODE(9)
π enum drm_mm_insert_mode π
okay so we're in the Kernel API Manual bestie, and this page is literally the whole vibe-check for how the DRM memory manager decides where to shove your node. no cap, it's giving "choose your own adventure" but for holes in address space π³οΈβ¨
π NAME π
enum drm_mm_insert_mode β the enum that controls search and allocation behaviour, i.e. the little brain that tells the range manager how to go find you a spot π
πΈ SYNOPSIS πΈ
enum drm_mm_insert_mode {
DRM_MM_INSERT_BEST ,
DRM_MM_INSERT_LOW ,
DRM_MM_INSERT_HIGH ,
DRM_MM_INSERT_EVICT ,
DRM_MM_INSERT_ONCE ,
DRM_MM_INSERT_HIGHEST ,
DRM_MM_INSERT_LOWEST
};
β¨ CONSTANTS β¨
seven constants, seven moods, all of them iconic in their own way π
DRM_MM_INSERT_BESTβ hunts down the smallest hole (inside the search range, obviously) that actually fits the node you want. then it allocates your node from the bottom of that hole. tiny hole, big slay π―DRM_MM_INSERT_LOWβ looks for the lowest hole (meaning the address closest to0, within the search range) that fits the node. allocates from the bottom of the hole. lowkey literally π«ΆDRM_MM_INSERT_HIGHβ looks for the highest hole (address closest toU64_MAX, within the search range) that fits the node. this one's special: it allocates the node from the top of the found hole, not the bottom. also heads up β the alignment you specified for the node gets applied to the base of the node (drm_mm_node.start). read that twice, it matters πDRM_MM_INSERT_EVICTβ searches for the most recently evicted hole (within the search range) that fits the node. this is the one you want immediately after running an eviction scan (peepdrm_mm_scan_init) and removing the selected nodes so a hole exists. allocates from the bottom of the found hole. recycling era β»οΈβ¨DRM_MM_INSERT_ONCEβ only checks the first hole for suitability, and if it doesn't work it reports-ENOSPCright away instead of checking every hole until something fits. important: it can only be used together with another search method, likeDRM_MM_INSERT_HIGHorDRM_MM_INSERT_LOW. it's a modifier, not a main character πDRM_MM_INSERT_HIGHESTβ only checks the highest hole (the hole with the largest address) and inserts the node at the top of it, or reports-ENOSPCif it's unsuitable. does not search all holes, so don't come for it π«πDRM_MM_INSERT_LOWESTβ only checks the lowest hole (the hole with the smallest address) and inserts the node at the bottom of it, or reports-ENOSPCif it's unsuitable. also does not search all holes. symmetric queen π
π¦ DESCRIPTION π¦
so struct drm_mm β the range manager β supports finding a suitable mode using a bunch of search trees. those trees are organised by size, by address, and by most recent eviction order. which is honestly so smart of them π
that means you the user get to pick: the smallest hole to reuse, the lowest or highest address to reuse, or just reuse the most recent eviction that fits. when it allocates the drm_mm_node from inside the hole, the drm_mm_insert_mode also dictates whether you allocate the lowest matching address or the highest. yes, the enum has opinions about both the search and the placement. main character energy fr π
ngl this is an enum, so the "modes" are just constants β but the behaviour they unlock is the whole point. don't skip the ONCE combo rule, it really will not work solo. π
π₯ SEE ALSO π₯
Kernel file ./include/drm/drm_mm.h β and honestly the whole friend group:
struct drm_mm_node(9)struct drm_mm(9)struct drm_mm_scan(9)drm_mm_node_allocated(9)drm_mm_initialized(9)drm_mm_hole_follows(9)drm_mm_hole_node_start(9)drm_mm_hole_node_end(9)drm_mm_nodes(9)drm_mm_for_each_node(9)drm_mm_for_each_node_safe(9)drm_mm_for_each_hole(9)drm_mm_insert_node_generic(9)drm_mm_insert_node(9)drm_mm_clean(9)drm_mm_for_each_node_in_range(9)drm_mm_scan_init(9)
and that's the whole page bestie π«Ά this one lives in ./include/drm, dated October 2026, in the Kernel API Manual β go be hydrated and go insert some nodes responsibly ππβπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms