Message ID | 20241204134410.1161769-5-dev@lankhorst.se (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | kernel/cgroups: Add "dmem" memory accounting cgroup. | expand |
Hi Lucas, Thomas, Rodrigo, We forgot to Cc you on this series, sorry. Could you have a look at it, and especially the following patch? On Wed, Dec 04, 2024 at 02:44:04PM +0100, Maarten Lankhorst wrote: > Add vram based cgroup eviction to Xe. > Most hardware with VRAM uses TTM for its management, and can be > similarly trivially enabled. > > Co-developed-by: Maxime Ripard <mripard@kernel.org> > Signed-off-by: Maxime Ripard <mripard@kernel.org> > Signed-off-by: Maarten Lankhorst <dev@lankhorst.se> > --- > drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > index c95728c45ea48..f4a16e5fa7700 100644 > --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > @@ -5,6 +5,7 @@ > */ > > #include <drm/drm_managed.h> > +#include <drm/drm_drv.h> > > #include <drm/ttm/ttm_placement.h> > #include <drm/ttm/ttm_range_manager.h> > @@ -311,6 +312,13 @@ int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr, > struct ttm_resource_manager *man = &mgr->manager; > int err; > > + if (mem_type != XE_PL_STOLEN) { > + const char *name = mem_type == XE_PL_VRAM0 ? "vram0" : "vram1"; > + man->cg = drmm_cgroup_register_region(&xe->drm, name, size); > + if (IS_ERR(man->cg)) > + return PTR_ERR(man->cg); > + } > + > man->func = &xe_ttm_vram_mgr_func; > mgr->mem_type = mem_type; > mutex_init(&mgr->lock); > -- > 2.43.0 >
On Thu, Dec 19, 2024 at 01:03:48PM +0100, Maxime Ripard wrote: > Hi Lucas, Thomas, Rodrigo, > > We forgot to Cc you on this series, sorry. Could you have a look at it, > and especially the following patch? I'm sorry for the delay here. I was following the thread on the side. I'm glad to see that we are finally going to get some cgroups support! Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Fell free to push this through any tree... > > > > On Wed, Dec 04, 2024 at 02:44:04PM +0100, Maarten Lankhorst wrote: > > Add vram based cgroup eviction to Xe. > > Most hardware with VRAM uses TTM for its management, and can be > > similarly trivially enabled. > > > > Co-developed-by: Maxime Ripard <mripard@kernel.org> > > Signed-off-by: Maxime Ripard <mripard@kernel.org> > > Signed-off-by: Maarten Lankhorst <dev@lankhorst.se> > > --- > > drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > > index c95728c45ea48..f4a16e5fa7700 100644 > > --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > > +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > > @@ -5,6 +5,7 @@ > > */ > > > > #include <drm/drm_managed.h> > > +#include <drm/drm_drv.h> > > > > #include <drm/ttm/ttm_placement.h> > > #include <drm/ttm/ttm_range_manager.h> > > @@ -311,6 +312,13 @@ int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr, > > struct ttm_resource_manager *man = &mgr->manager; > > int err; > > > > + if (mem_type != XE_PL_STOLEN) { > > + const char *name = mem_type == XE_PL_VRAM0 ? "vram0" : "vram1"; > > + man->cg = drmm_cgroup_register_region(&xe->drm, name, size); > > + if (IS_ERR(man->cg)) > > + return PTR_ERR(man->cg); > > + } > > + > > man->func = &xe_ttm_vram_mgr_func; > > mgr->mem_type = mem_type; > > mutex_init(&mgr->lock); > > -- > > 2.43.0 > >
diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c index c95728c45ea48..f4a16e5fa7700 100644 --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c @@ -5,6 +5,7 @@ */ #include <drm/drm_managed.h> +#include <drm/drm_drv.h> #include <drm/ttm/ttm_placement.h> #include <drm/ttm/ttm_range_manager.h> @@ -311,6 +312,13 @@ int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr, struct ttm_resource_manager *man = &mgr->manager; int err; + if (mem_type != XE_PL_STOLEN) { + const char *name = mem_type == XE_PL_VRAM0 ? "vram0" : "vram1"; + man->cg = drmm_cgroup_register_region(&xe->drm, name, size); + if (IS_ERR(man->cg)) + return PTR_ERR(man->cg); + } + man->func = &xe_ttm_vram_mgr_func; mgr->mem_type = mem_type; mutex_init(&mgr->lock);