dma_free_contiguous(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– dma_free_contiguous β€” like, the kernel API manual, section 9, bestie πŸ’–

Okay so before we even start β€” this is from the Kernel API Manual, section 9, and yes we are absolutely getting into it. Sit down, grab a strawberry πŸ“, and let's talk about giving memory back.


✨ NAME ✨

dma_free_contiguous β€” release allocated pages πŸŽ€

Like, it's the cleanup crew. The "ok bestie, party's over, everybody out" of contiguous DMA pages. No cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

void dma_free_contiguous (struct device *dev , struct page *page ,
       size_t size );

That's it. That's the whole vibe check. Three things in, nothing out β€” it returns void, so don't be out here expecting a status report. πŸ™ˆ


🌸 ARGUMENTS 🌸

  • dev β€” Pointer to the device for which the pages were allocated. Like, which device's memory are we handing back? Gotta be specific, bestie. πŸ‘‘
  • page β€” Pointer to the allocated pages. This is the actual stuff you're freeing. Your main character. ✨
  • size β€” Size of allocated pages. Yes, you have to tell it how much. It's not a mind reader. πŸ’…

πŸ’œ DESCRIPTION πŸ’œ

So here's the tea, fr fr: this function releases memory that was allocated by dma_alloc_contiguous. It's the ✨ reverse ✨ of that one. Cleanup arc. We love to see it. 🧚

Now, the way it actually works is genuinely kind of iconic: cma_release returns false when the pages you provided do not belong to the contiguous area, and true otherwise. So the function checks that return value, and β€” plot twist β€” upon a false-return it does a fallback __free_pages. 🫢

Lowkey important: that false path means your pages weren't from the contiguous area, so it just frees them the regular way instead. Not me being dramatic β€” that's literally what the manpage says. 😭

So: true β†’ CMA handled it. false β†’ fallback __free_pages swings in and saves the day. Either way, the pages get freed. Slay. πŸ”₯


⭐ SEE ALSO ⭐

All the siblings. The whole contiguous-family group chat. 🌈


Okay that's the whole page, bestie β€” no filler, all facts. This lil' beauty comes to you courtesy of the source path ./kernel/dma, dated October 2026, in section 9 of the Kernel API Manual. Go free your pages responsibly. πŸŽ€πŸ’…πŸ¦‹

πŸ“¦ where this page comes from