ENUM DRM_MM_INSERT_MODE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 to 0, 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 to U64_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 (peep drm_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 -ENOSPC right away instead of checking every hole until something fits. important: it can only be used together with another search method, like DRM_MM_INSERT_HIGH or DRM_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 -ENOSPC if 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 -ENOSPC if 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:


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