dma_fence_dedup_array(9)
β¨ 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 ofdma_fencepointers that's about to get deduplicated. yes she's getting modified, we'll get to that πnum_fencesβ how many entries are actually in thatfencesarray. 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 π
- Kernel file
./drivers/dma-buf/dma-fence-unwrap.c dma_fence_unwrap_first(9)dma_fence_unwrap_next(9)
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
- 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