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. [1] https://lore.kernel.org/all/[email protected]/ [2] https://lore.kernel.org/all/[email protected]/ Signed-off-by: Eric Chanudet <[email protected]> --- Changes in v2: - Rebase on Maxime's introduction of dmem to the cma allocator: https://lore.kernel.org/all/[email protected]/ - Remove the dmem region registration from the cma dma-buf heap - Remove the misplaced logic for the default region. - Link to v1: https://lore.kernel.org/r/[email protected] --- Eric Chanudet (1): dma-buf: heaps: cma: charge each cma heap's dmem Maxime Ripard (2): cma: Register dmem region for each cma region cma: Provide accessor to cma dmem region drivers/dma-buf/heaps/cma_heap.c | 15 ++++++++++++++- include/linux/cma.h | 9 +++++++++ mm/cma.c | 20 +++++++++++++++++++- mm/cma.h | 3 +++ 4 files changed, 45 insertions(+), 2 deletions(-) --- base-commit: 948e195dfaa56e48eabda591f97630502ff7e27e change-id: 20260128-dmabuf-heap-cma-dmem-f4120a2df4a8 Best regards, -- Eric Chanudet <[email protected]>
