STRUCT DEV_PAGEMAP(9)
π struct dev_pagemap(9) π
okay so this is a page out of the Kernel API Manual, and it's literally the blueprint for struct dev_pagemap β the metadata bestie for ZONE_DEVICE mappings. strap in π
β¨ NAME β¨
struct dev_pagemap β metadata for ZONE_DEVICE mappings. that's it, that's the vibe π«Ά
πΈ SYNOPSIS πΈ
here's the whole struct, character for character, no cap:
struct dev_pagemap {
struct vmem_altmap altmap;
struct percpu_ref ref;
struct completion done;
enum memory_type type;
unsigned int flags;
unsigned long vmemmap_shift;
const struct dev_pagemap_ops *ops;
void *owner;
int nr_range;
union {
struct range range;
struct range ranges[];
};
};
π Members π
every single field, explained, because we don't skip β¨
altmapβ pre-allocated/reserved memory for vmemmap allocations. it's the reserved little stash πrefβ reference count that pins thedevm_memremap_pagesmapping. keeps it alive, main character energy π₯doneβ completion forref. whenrefis finished, this is how you know πtypeβ memory type: seeMEMORY_*above inmemremap.h. iykyk πflagsβPGMAP_*flags to specify defailed behavior. (their spelling, not mine bestie π)vmemmap_shiftβ structural definition of how the vmemmap page metadata is populated, specifically the metadata page order. a zero value (that's the default) uses base pages as the vmemmap metadata representation. a bigger value will set up compound struct pages of the requested order value. so like, order matters βopsβ method table. the whole friend group of functions πownerβ an opaque pointer identifying the entity that manages this instance. used by various helpers to make sure that no foreignZONE_DEVICEmemory is accessed. protecting the group chat from randos πnr_rangeβ number of ranges to be mapped π’{unnamed_union}β anonymous. she has no name but she serves πrangeβ range to be mapped whennr_range == 1βοΈrangesβ array of ranges to be mapped whennr_range > 1π
π¦ SEE ALSO π¦
- Kernel file
./include/linux/memremap.h struct vmem_altmap(9)
ngl, if you're poking at ZONE_DEVICE mappings without reading the members list first, that's a vibe check you will fail π read them all, fr fr.
and that's the page, bestie π this cutie came from ./include/linux, dated October 2026, straight out of the Kernel API Manual β struct dev_pagemap(9), periodt. πβ¨
π¦ 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