[PATCH v5 3/8] dma-buf: transfer objcg charges via DMA_BUF_IOCTL_XFER_CHARGE

sashiko-bot at kernel.org sashiko-bot at kernel.org
Wed Nov 18 08:41:01 UTC 2026


> dma-heap already supports charging a specific cgroup at allocation
> time via charge_fd in DMA_HEAP_IOCTL_ALLOC. However, dma-bufs can
> originate from any exporter (DRM, V4L2, etc.), and the allocator may
> not know the final owner at allocation time.
> 
> Add DMA_BUF_IOCTL_XFER_CHARGE to transfer a dma-buf's objcg charge
> to a different cgroup after allocation. The target is identified by
> charge_fd, which may be a cgroupfd or a pidfd.
> 
> The transfer charges the new cgroup before uncharging the old one,
> preserving the original charge on failure. Concurrent transfers are
> serialized by the dma-buf reservation lock, so lockdep covers the
> locking order of the charge path early. The transfer implementation
> is generic (obj_cgroup_transfer_charge) and not dma-buf specific, so
> it can be reused by other subsystems.
> [ ... ]
>   /* charge now on app1's cgroup */
>   close(cg_fd);
> 
> Reviewed-by: Christian König <christian.koenig at amd.com>
> Signed-off-by: Albert Esteve <aesteve at redhat.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-v2_20230123_tjmercier_google_com-v5-0-1ce975f2a9ad@redhat.com?part=3




More information about the Linux-security-module-archive mailing list