[PATCH v2 0/3] dma-buf: heaps: cma: enable dmem cgroup accounting
From: Eric Chanudet
Date: Wed Feb 18 2026 - 12:15:12 EST
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/20250310-dmem-cgroups-v1-0-2984c1bc9312@xxxxxxxxxx/
[2] https://lore.kernel.org/all/20260116-dmabuf-heap-system-memcg-v3-0-ecc6b62cc446@xxxxxxxxxx/
Signed-off-by: Eric Chanudet <echanude@xxxxxxxxxx>
---
Changes in v2:
- Rebase on Maxime's introduction of dmem to the cma allocator:
https://lore.kernel.org/all/20250310-dmem-cgroups-v1-0-2984c1bc9312@xxxxxxxxxx/
- 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/20260130-dmabuf-heap-cma-dmem-v1-1-3647ea993e99@xxxxxxxxxx
---
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 <echanude@xxxxxxxxxx>