edac_mc_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ edac_mc_alloc(9) πŸŽ€

okay so bestie, welcome to the Kernel API Manual page for edac_mc_alloc β€” she's a function, she's iconic, she allocates and partially fills a struct &mem_ctl_info, and honestly? she eats. πŸ’…


✨ NAME ✨

edac_mc_alloc β€” Allocate and partially fill a struct &mem_ctl_info. 🫢


🌸 SYNOPSIS 🌸

struct mem_ctl_info * edac_mc_alloc (unsigned int mc_num , unsigned int
       n_layers , struct edac_mc_layer *layers , unsigned int sz_pvt );

like literally that's the whole signature, no cap πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • mc_num β€” Memory controller number. that's the number, bestie πŸ”’
  • n_layers β€” Number of MC hierarchy layers. how many layers we're layering 🌈
  • layers β€” Describes each layer as seen by the Memory Controller. it's giving the blueprint πŸŽ€
  • sz_pvt β€” size of private storage needed. your own lil private stash ✨

πŸ’œ DESCRIPTION πŸ’œ

okay so the vibes here are efficiency. Everything is kmalloc'ed as one big chunk β€” more efficient. one big chunk, one big slay. πŸ”₯

but ⚠️ Only can be used if all structures have the same lifetime β€” otherwise you have to allocate and initialize your own structures. fr fr, same lifetime or it's DIY time 😭

Use edac_mc_free to free mc structures allocated by this function. she giveth, and she taketh away 🧚

πŸ’€ NOTE: πŸ’€

drivers handle multi-rank memories in different ways: in some drivers, one multi-rank memory stick is mapped as one entry, while, in others, a single multi-rank memory stick would be mapped into several entries. currently, this function will allocate multiple struct dimm_info on such scenarios, as grouping the multiple ranks require drivers change. iykyk πŸ€·β€β™€οΈ


⭐ RETURN ⭐

On success, return a pointer to struct mem_ctl_info pointer; NULL otherwise. we love a pointer that either works or doesn't πŸ’€


🌈 SEE ALSO 🌈

Kernel file ./drivers/edac/edac_mc.h and her whole friend group:

go read them, they're all main character energy πŸ‘‘


and that's the page bestie!! πŸ’–βœ¨ this one comes from ./drivers/edac, dated October 2026, and yes she's officially edac_mc_alloc(9) β€” stan her, memorize her, periodt πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from