Skip to content

RFC Proposal for a GPU cgroup controller

Hridya Valsaraju cgroups dri-devel linux-doc linux-media lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6gpu: rfc: Proposal for a GPU cgroup controllerDocumentation/gpu/rfc/gpu-cgroup.rst Documentation/gpu/rfc/index.rst+196 -00 replies
2/6cgroup: gpu: Add a cgroup controller for allocator attribution of GPU memoryinclude/linux/cgroup_gpu.h include/linux/cgroup_subsys.h init/Kconfig +2 more+437 -03 replies
3/6dmabuf: heaps: Use the GPU cgroup charge/uncharge APIsdrivers/dma-buf/dma-heap.c drivers/dma-buf/heaps/system_heap.c include/linux/dma-heap.h+63 -00 replies
4/6dma-buf: Add DMA-BUF exporter op to charge a DMA-BUF to a cgroup.include/linux/dma-buf.h+18 -07 replies
5/6dmabuf: system_heap: implement dma-buf op for GPU cgroup charge transferdrivers/dma-buf/heaps/system_heap.c+43 -00 replies
6/6android: binder: Add a buffer flag to relinquish ownership of fdsdrivers/android/binder.c include/uapi/linux/android/binder.h+33 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/6] Proposal for a GPU cgroup controller

This patch series revisits the proposal for a GPU cgroup controller to track and limit memory allocations by various device/allocator subsystems. The patch series also contains a simple prototype to illustrate how Android intends to implement DMA-BUF allocator attribution using the GPU cgroup controller. The prototype does not include resource limit enforcements.

History of the GPU cgroup controller
====================================
The GPU/DRM cgroup controller came into being when a consensus[1] was reached that the resources it tracked were unsuitable to be integrated into memcg. Originally, the proposed controller was specific to the DRM subsystem and was intended to track GEM buffers and GPU-specific resources[2]. In order to help establish a unified memory accounting model for all GPU and all related subsystems, Daniel Vetter put forth a suggestion to move it out of the DRM subsystem so that it can be used by other DMA-BUF exporters as well[3]. This RFC proposes an interface that does the same.

[1]: https://patchwork.kernel.org/project/dri-devel/cover/20190501140438.9506-1-brian.welty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org/#22624705
[2]: https://lore.kernel.org/amd-gfx/20210126214626.16260-1-brian.welty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org/
[3]: https://lore.kernel.org/amd-gfx/YCVOl8%[email protected]/

Hridya Valsaraju (6):
gpu: rfc: Proposal for a GPU cgroup controller
cgroup: gpu: Add a cgroup controller for allocator attribution of GPU
memory
dmabuf: heaps: Use the GPU cgroup charge/uncharge APIs
dma-buf: Add DMA-BUF exporter op to charge a DMA-BUF to a cgroup.
dmabuf: system_heap: implement dma-buf op for GPU cgroup charge
transfer
android: binder: Add a buffer flag to relinquish ownership of fds

 Documentation/gpu/rfc/gpu-cgroup.rst | 192 +++++++++++++++++
 Documentation/gpu/rfc/index.rst      |   4 +
 drivers/android/binder.c             |  32 +++
 drivers/dma-buf/dma-heap.c           |  27 +++
 drivers/dma-buf/heaps/system_heap.c  |  68 ++++++
 include/linux/cgroup_gpu.h           | 120 +++++++++++
 include/linux/cgroup_subsys.h        |   4 +
 include/linux/dma-buf.h              |  18 ++
 include/linux/dma-heap.h             |  11 +
 include/uapi/linux/android/binder.h  |   1 +
 init/Kconfig                         |   7 +
 kernel/cgroup/Makefile               |   1 +
 kernel/cgroup/gpu.c                  | 305 +++++++++++++++++++++++++++
 13 files changed, 790 insertions(+)
 create mode 100644 Documentation/gpu/rfc/gpu-cgroup.rst
 create mode 100644 include/linux/cgroup_gpu.h
 create mode 100644 kernel/cgroup/gpu.c
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog