add_mem_range(9)
π add_mem_range(9) β the glow-up
okay so bestie, welcome to add_mem_range(9), straight outta the Kernel API Manual β¨ this is the page where a memory range either gets merged into the existing list (if it overlaps, iykyk) or shows up brand new like it just walked into the group chat. it's giving "range management main character energy" π
β¨ SYNOPSIS β¨
int add_mem_range (struct crash_mem **mem_ranges , u64 base , u64 size
);
that's the whole vibe. one function, three args, returns an int. slay π
πΈ ARGUMENTS πΈ
mem_rangesβ the range list you're adding to. it's a pointer-to-pointer (struct crash_mem **), so yeah, the list itself can get re-pointed under you. respect the double star π«Άbaseβ base address of the range you're adding, au64. literally where the range starts.sizeβ size of the memory range you're adding, also au64. how thicc the range is.
π DESCRIPTION π
so what actually happens? the page keeps it cute and short:
(Re)allocates memory, if needed. π
and then:
Returns 0 on success, negative errno on error. β
/ π
that's it, that's the whole description. no cap, some manpages are like three sentences and honestly? iconic. it knows what it is.
β οΈ heads up bestie: "negative errno on error" means you check for< 0, not for-1specifically. the errno values are whatever the kernel felt like that day π
and the real headline up top, in case you missed it: it updates an existing memory range if there's an overlap, and otherwise adds a new memory range. so either way your range is in there. periodt. π
π¦ SEE ALSO π¦
the whole friend group π«Ά first the kernel file itself:
- Kernel file
./arch/powerpc/kexec/ranges.cβ that's the source, that's where it lives, go say hi
then the extended squad, all (9):
get_max_nr_ranges(9)get_mem_rngs_size(9)__add_mem_range(9)__merge_memory_ranges(9)sort_memory_ranges(9)realloc_mem_ranges(9)add_tce_mem_ranges(9)add_initrd_mem_range(9)add_htab_mem_range(9)add_kernel_mem_range(9)add_rtas_mem_range(9)add_opal_mem_range(9)add_reserved_mem_ranges(9)get_reserved_memory_ranges(9)get_exclude_memory_ranges(9)get_usable_memory_ranges(9)get_crash_memory_ranges(9)
like, that's a whole friend group of range functions and you're invited π
aaaand that's the page!! mwah π this one ships from ./arch/powerpc/kexec and it's dated October 2026 β so yeah, bookmark it, screenshot it, send it to the group chat, and remember: overlap = update, no overlap = add. you got this bestie πβπ
π¦ 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