From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org, tj@kernel.org, christian.koenig@amd.com
Cc: cgroups@vger.kernel.org
Subject: [PATCH 5/5] nouveau: add memcg integration
Date: Thu, 24 Apr 2025 07:37:07 +1000 [thread overview]
Message-ID: <20250423214321.100440-6-airlied@gmail.com> (raw)
In-Reply-To: <20250423214321.100440-1-airlied@gmail.com>
From: Dave Airlie <airlied@redhat.com>
This just adds the memcg init and account_op support.
Signed-off-by: Dave Airlie <airlied@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
next prev parent reply other threads:[~2025-04-23 21:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 21:37 [rfc] drm/ttm/memcg: simplest initial memcg/ttm integration Dave Airlie
2025-04-23 21:37 ` [PATCH 1/5] memcg: add GPU statistic Dave Airlie
2025-04-23 21:37 ` [PATCH 2/5] memcg: export stat change function Dave Airlie
2025-04-23 21:37 ` [PATCH 3/5] ttm: add initial memcg integration Dave Airlie
2025-04-23 21:37 ` [PATCH 4/5] amdgpu: add support for " Dave Airlie
2025-04-23 21:37 ` Dave Airlie [this message]
2025-04-28 10:43 ` [rfc] drm/ttm/memcg: simplest initial memcg/ttm integration Christian König
2025-04-28 16:00 ` Simona Vetter
2025-04-28 19:31 ` Dave Airlie
2025-04-29 7:29 ` Christian König
-- strict thread matches above, loose matches on Subject: below --
2025-05-02 3:35 [rfc] drm/ttm/memcg: simplest initial memcg/ttm integration (v2) Dave Airlie
2025-05-02 3:36 ` [PATCH 5/5] nouveau: add memcg integration Dave Airlie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250423214321.100440-6-airlied@gmail.com \
--to=airlied@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.