__add_memory_driver_managed(9)
π 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, ormovable. 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 π₯
0on success π- negative error code on failure π
that's it. zero or sad number. periodt.
β SEE ALSO β
- Kernel file
./mm/memory_hotplug.c __remove_pages(9)add_memory_driver_managed(9)try_offline_node(9)__remove_memory(9)offline_and_remove_memory_ranges(9)
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
- 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