merge_system_ram_resource(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… merge_system_ram_resource(9) πŸ’…

okay so this is a page from the Kernel API Manual β€” yes, the Kernel API Manual, we're literally reading kernel docs for fun now, this is the energy we're bringing ✨


🌸 NAME 🌸

merge_system_ram_resource β€” marks the System RAM resource as mergeable and then tries to merge it with adjacent resources that are also mergeable 🫢


πŸŽ€ SYNOPSIS πŸŽ€

void merge_system_ram_resource (struct resource *res );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • res β€” the resource descriptor, bestie. that's it, that's the whole argument πŸ’…

✨ DESCRIPTION ✨

so this interface? it's intended for memory hotplug, okay. picture it: a driver is adding a whole bunch of contiguous system ram resources (like, via add_memory*()), and honestly the actual resource boundaries are not of interest here β€” lowkey irrelevant, for example it might be relevant for DIMMs 🧚

only resources that check all these boxes get considered:

  • they're marked mergeable,
  • they have the same parent,
  • and they don't have any children.

periodt. those are the rules πŸ’–

and one more thing β€” all mergeable resources must be immutable during the request. no cap. they gotta stay still while this is happening πŸ”₯


πŸ’€ NOTE πŸ’€

  • the caller has to make sure that no pointers to resources that are marked mergeable are used anymore after this call β€” because the resource might be freed and the pointer might be stale! 😭 like genuinely, that's a use-after-free vibe and we do not want it πŸ™ˆ
  • release_mem_region_adjustable will split on demand on memory hotunplug πŸ‘‘

🌈 SEE ALSO 🌈

kernel file ./kernel/resource.c β€” and the whole friend group:


ngl the mergeable-resource rules are strict bestie, read the NOTE section twice before you ship 🫢

okay and for the sign-off: this lil beauty comes from ./kernel and it's dated October 2026 β€” that's the source, the version, and the date, all accounted for, slay πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from