dma_fence_dedup_array(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ dma_fence_dedup_array ✨

okay so bestie, we're in the Kernel API Manual today and this one is honestly such a vibe β€” it's called dma_fence_dedup_array and it does exactly what it says on the tin: sorts and deduplicates an array of dma_fence pointers. clean, simple, iconic. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

size_t dma_fence_dedup_array (struct dma_fence **fences , size_t
num_fences );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • fences β€” the array of dma_fence pointers that's about to get deduplicated. yes she's getting modified, we'll get to that πŸ‘€
  • num_fences β€” how many entries are actually in that fences array. the count, the receipts, the number.

πŸ’– DESCRIPTION πŸ’–

so here's the tea 🍡 β€” this function sorts the input array by context, and then removes duplicate fences that share the same context, keeping only the most recent one. like, if two fences have the same context, the newer one is the main character and the older dupe gets sent home. periodt.

and ngl, bestie, this is the part you gotta know: the array is modified in-place. not a copy, not a new array, the actual thing you passed in. and any unreferenced duplicate fences? they get released via dma_fence_put. so like, don't be out here holding references to the dupes afterwards, that's giving undefined chaos and we don't do that. 😭

the function then returns the new number of fences after deduplication. slay.


🌸 RETURN 🌸

the number of unique fences remaining in the array. that's it, that's the whole return value. 🫢


🌈 SEE ALSO 🌈


ok final vibe check: sort by context, drop the dupes, keep the freshest, modify in-place, dma_fence_put the leftovers. iykyk. 🧚

later bestie πŸ’œ β€” this page lives in ./drivers/dma-buf, it's the October 2026 era, and you can find it filed under dma_fence_dedup_array(9). mwah πŸŽ€

πŸ“¦ where this page comes from