[PATCH] drm/amdgpu: Add cgroups implementation

Christian König christian.koenig at amd.com
Fri Mar 28 12:54:37 UTC 2025


Am 27.03.25 um 20:51 schrieb Natalie Vock:
> From: Maarten Lankhorst <dev at lankhorst.se>
>
> Similar to xe, enable some simple management of VRAM only.
>
> Co-developed-by: Maxime Ripard <mripard at kernel.org>
> Signed-off-by: Maxime Ripard <mripard at kernel.org>
> Signed-off-by: Maarten Lankhorst <dev at lankhorst.se>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>
> Resending this one since it got lost in the initial dmem cgroup
> submission. Probably needs to be merged through drm-misc-next since
> amd-staging-drm-next doesn't have dmem cgroups yet.
>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index ff5e52025266c..7b86d7f9d5d56 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -24,6 +24,7 @@
>
>  #include <linux/dma-mapping.h>
>  #include <drm/ttm/ttm_range_manager.h>
> +#include <drm/drm_drv.h>
>
>  #include "amdgpu.h"
>  #include "amdgpu_vm.h"
> @@ -908,6 +909,9 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
>  	struct ttm_resource_manager *man = &mgr->manager;
>  	int err;
>
> +	man->cg = drmm_cgroup_register_region(adev_to_drm(adev), "vram", adev->gmc.real_vram_size);
> +	if (IS_ERR(man->cg))
> +		return PTR_ERR(man->cg);
>  	ttm_resource_manager_init(man, &adev->mman.bdev,
>  				  adev->gmc.real_vram_size);
>
>
> base-commit: 1822532477cb5f007313de4c70079c09aaa270d5
> --
> 2.49.0
>



More information about the amd-gfx mailing list