merge_system_ram_resource(9)
π 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_adjustablewill split on demand on memory hotunplug π
π SEE ALSO π
kernel file ./kernel/resource.c β and the whole friend group:
request_resource_conflict(9)request_resource(9)release_resource(9)find_next_res(9)walk_iomem_res_desc(9)region_intersects(9)find_resource_space(9)reallocate_resource(9)allocate_resource(9)lookup_resource(9)insert_resource_conflict(9)insert_resource(9)insert_resource_expand_to_fit(9)remove_resource(9)adjust_resource(9)resource_alignment(9)__request_region(9)__release_region(9)release_mem_region_adjustable(9)devm_request_resource(9)devm_release_resource(9)devm_request_free_mem_region(9)alloc_free_mem_region(9)
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
- 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