Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dma-buf: heaps: add parameter to account allocations using cgroup

Add a parameter to enable dma-buf heaps allocation accounting using
cgroup for heaps that implement it. It is disabled by default as doing
so incurs caveats based on how memcg currently accounts for shared
buffers.

Signed-off-by: Eric Chanudet <echanude@redhat.com>
Reviewed-by: T.J. Mercier <tjmercier@google.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patch.msgid.link/20260116-dmabuf-heap-system-memcg-v3-1-ecc6b62cc446@redhat.com

authored by

Eric Chanudet and committed by
Sumit Semwal
bb33013b 1c21f240

+7
+5
drivers/dma-buf/dma-heap.c
··· 49 49 static struct class *dma_heap_class; 50 50 static DEFINE_XARRAY_ALLOC(dma_heap_minors); 51 51 52 + bool __read_mostly mem_accounting; 53 + module_param(mem_accounting, bool, 0444); 54 + MODULE_PARM_DESC(mem_accounting, 55 + "Enable cgroup-based memory accounting for dma-buf heap allocations (default=false)."); 56 + 52 57 static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len, 53 58 u32 fd_flags, 54 59 u64 heap_flags)
+2
include/linux/dma-heap.h
··· 46 46 47 47 struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info); 48 48 49 + extern bool mem_accounting; 50 + 49 51 #endif /* _DMA_HEAPS_H */