__add_memory_driver_managed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay bestie, so __add_memory_driver_managed is literally the function that adds driver-managed memory with an explicit online_type β€” like, it tells the kernel exactly how this memory should come online instead of just vibing and guessing. slay. πŸŽ€


✨ SYNOPSIS ✨

int __add_memory_driver_managed (int nid , u64 start , u64 size , const
char *resource_name , mhp_t mhp_flags , enum mmop online_type );

that's the whole signature, no cap β€” six arguments, and every single one matters. let's break them down 🫢


🌸 ARGUMENTS 🌸

  • nid β€” the NUMA node ID where the memory is gonna be added. like, which node is getting this new RAM, iykyk.
  • start β€” the start physical address of the memory range. where the party begins. πŸ’…
  • size β€” the size of the memory range, in bytes. yes, bytes. the whole range, not a lil piece.
  • resource_name β€” the resource name, and it has to be in the format "System RAM ($DRIVER)". this one's visible via /proc/iomem, so don't freestyle it. 😭
  • mhp_flags β€” memory hotplug flags. the little toggles that ride along with the hotplug.
  • online_type β€” the auto-online behavior: offline, online, kernel, or movable. you're picking how this memory shows up. main character decision, honestly. πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function adds special, driver-managed memory to the system as system RAM. the twist? this memory is not exposed via the raw firmware-provided memmap as system RAM. instead, it's detected and added by a driver β€” during cold boot, after a reboot, and after kexec. literally all three, bestie. 🌈

<div></div>

now, why should this memory not be used for the initial memmap of a kexec kernel, or for placing kexec images? two iconic reasons:

  • the booting kernel is in charge of determining how this memory will be used (e.g., use persistent memory as system RAM) β€” the kernel's the main character here, not you. πŸ’€
  • coordination with a hypervisor</> is required before this memory can be used (e.g., inaccessible parts). gotta check in with the hypervisor first, fr fr.

<div></div>

for this memory, no entries in /sys/firmware/memmap (the "raw firmware-provided memory map") are created. also, the created memory resource is flagged with IORESOURCE_SYSRAM_DRIVER_MANAGED, so in-kernel users can special-case this memory as well β€” especially so they don't place kexec images onto it. 🚫

<div></div>

and listen: the resource_name (which you can see via /proc/iomem, btw) has to have the format:

"System RAM ($DRIVER)"

that's not a suggestion, that's the rule. 🌺

lowkey important: the <italic>$DRIVER</italic> part is a placeholder for the actual driver name β€” the format itself is non-negotiable. don't come at the kernel with a random string, it's giving chaos. πŸ™ˆ

πŸ”₯ RETURN πŸ”₯

  • 0 on success πŸŽ‰
  • negative error code on failure 😭

that's it. zero or sad number. periodt.


⭐ SEE ALSO ⭐

go read those next, bestie β€” the lore goes deep. πŸ“šπŸ’œ


okay and for the cute lil sign-off: this whole thing lives at ./mm (that's where the source is, slay), it's dated October 2026, and the page name is __add_memory_driver_managed(9) in the Kernel API Manual. bye bestie, go add some driver-managed memory responsibly πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from