__netmem_to_nmdesc(9)
π __netmem_to_nmdesc(9)
okay so real talk, bestie β this one lives in the Kernel API Manual, and it's the unsafe speedrun version of the netmem-to-desc glow-up β¨ read the warnings, i'm literally begging π«Ά
πΈ NAME
__netmem_to_nmdesc β unsafely get pointer to the &netmem_desc backing @netmem π
like yeah it gives you the pointer, but it does it unsafely, and the man page said what it said, so don't come crying to me π
β¨ SYNOPSIS
struct netmem_desc * __netmem_to_nmdesc (netmem_ref netmem );
one function, one argument, no thoughts head empty, straight in and straight out π
π ARGUMENTS
netmemβ the netmem reference you want to convert, bestie. that's it. that's the whole input πΈ
π¦ DESCRIPTION
okay so this is the unsafe version π and it can be used only when netmem is always backed by system memory. say it with me: only when it's always backed by system memory. π₯
the tradeoff is iconic honestly β it performs faster and generates smaller object code. the way it does that? no check for the LSB, no WARN π
so it's just vibes and raw speed, no safety net, no little warning sign, nothing π§
β οΈ and here's the part where you gotta pay attention: when netmem points to IOV, this provokes undefined behaviour. not "maybe", not "kinda", provokes undefined behaviour. main character energy of the worst kind ππ
π RETURN
pointer to the netmem_desc β but fr fr, it's garbage if netmem is not backed by system memory ποΈβ¨ it does not check. it does not warn. it just hands you a pointer and wishes you the best π«Ά
π SEE ALSO
- Kernel file
./include/net/netmem.h netmem_ref(9)__netmem_to_page(9)virt_to_netmem(9)__netmem_get_pp(9)__netmem_address(9)netmem_is_pfmemalloc(9)
like the whole netmem friend group, go say hi π¦π
mwah π that's the whole page! this lil icon ships out of ./include/net and the version vibes are stamped October 2026 β so yeah, that's the tea, go forth and please only call this when you actually know it's system memory, i believe in you πβπ
π¦ 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