kvmemdup(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– kvmemdup(9) πŸ’–

okay so real talk, bestie, this is a page from the Kernel API Manual, and it's about kvmemdup β€” the "copy this chunk of memory for me please" girlie. she's giving allocator energy and we're obsessed. let's get into it ✨


🌸 NAME 🌸

kvmemdup β€” duplicate region of memory. that's it, that's the whole vibe. she copies a region of memory. periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

void * kvmemdup (const void *src , size_t len , gfp_t gfp );

like, look at her. three arguments. returns a void *. so clean, so iconic πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • src β€” the memory region you wanna duplicate. the original. the main character, if you will πŸ‘‘
  • len β€” how long that memory region is. gotta tell her the length or she's just guessing, and we don't guess, we know ✨
  • gfp β€” the GFP mask to use. that's the flags she gets to allocate with, no cap 🫢

⭐ RETURN ⭐

she hands you back a newly allocated copy of src, or NULL if something goes wrong 😭 β€” that's the error case, so like, check it, bestie, fr fr.

⚠️ important vibe check: the result may be not physically contiguous. do not assume it is. she said what she said πŸ’€

and when you're done with it? free it with kvfree. don't just leave it hanging, that's rude and also a leak πŸ™ˆ


🌈 SEE ALSO 🌈

kernel file ./mm/util.c, plus this whole friend group right here β€” go say hi πŸ‘‹πŸ’–


and that's the whole page, bestie 🧚 ty for coming to my ted talk. this one lives in the ./mm directory and it's dated October 2026 β€” so like, future girlie behavior, we love to see it πŸ’œβœ¨ slay!

πŸ“¦ where this page comes from