Hi Christian, On Fri, Feb 20, 2026 at 10:45:08AM +0100, Christian König wrote: > On 2/20/26 02:14, T.J. Mercier wrote: > > On Wed, Feb 18, 2026 at 9:15 AM Eric Chanudet wrote: > > > > Hi Eric, > > > >> An earlier series[1] from Maxime introduced dmem to the cma allocator in > >> an attempt to use it generally for dma-buf. Restart from there and apply > >> the charge in the narrower context of the CMA dma-buf heap instead. > >> > >> In line with introducing cgroup to the system heap[2], this behavior is > >> enabled based on dma_heap.mem_accounting, disabled by default. > >> > >> dmem is chosen for CMA heaps as it allows limits to be set for each > >> region backing each heap. The charge is only put in the dma-buf heap for > >> now as it guaranties it can be accounted against a userspace process > >> that requested the allocation. > > > > But CMA memory is system memory, and regular (non-CMA) movable > > allocations can occur out of these CMA areas. So this splits system > > memory accounting between memcg (from [2]) and dmem. If I want to put > > a limit on system memory use I have to adjust multiple limits (memcg + > > dmems) and know how to divide the total between them all. > > > > How do you envision using this combination of different controllers? > > Yeah we have this problem pretty much everywhere. > > There are both use cases where you want to account device allocations > to memcg and when you don't want that. > > From what I know at the moment it would be best if the administrator > could say for each dmem if it should account additionally to memcg or > not. > > Using module parameters to enable/disable it globally is just a > workaround as far as I can see. That's a pretty good idea! It would indeed be a solution that could satisfy everyone (I assume?). Maxime