From: Dave Airlie <airl...@redhat.com> This just adds the memcg init and account_op support.
Signed-off-by: Dave Airlie <airl...@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 1 + drivers/gpu/drm/nouveau/nouveau_gem.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 2016c1e7242f..8e2da4d48ce3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -350,6 +350,7 @@ nouveau_bo_init(struct nouveau_bo *nvbo, u64 size, int align, u32 domain, struct ttm_operation_ctx ctx = { .interruptible = false, .no_wait_gpu = false, + .account_op = true, .resv = robj, }; diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 67e3c99de73a..56899c89bdd8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -87,6 +87,7 @@ nouveau_gem_object_del(struct drm_gem_object *gem) return; } + mem_cgroup_put(nvbo->bo.memcg); ttm_bo_put(&nvbo->bo); pm_runtime_mark_last_busy(dev); @@ -254,6 +255,7 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain, if (IS_ERR(nvbo)) return PTR_ERR(nvbo); + nvbo->bo.memcg = get_mem_cgroup_from_mm(current->mm); nvbo->bo.base.funcs = &nouveau_gem_object_funcs; nvbo->no_share = domain & NOUVEAU_GEM_DOMAIN_NO_SHARE; -- 2.49.0