aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomer Tayar <ttayar@habana.ai>2019-08-04 07:03:41 +0000
committerOded Gabbay <oded.gabbay@gmail.com>2019-08-12 09:01:10 +0300
commitc8113756ba27298d6e95403c087dc5881b419a99 (patch)
tree447fa550a55576d967ea439be1b4ac49e11c92de /drivers/misc
parenthabanalabs: Avoid double free in error flow (diff)
downloadlinux-dev-c8113756ba27298d6e95403c087dc5881b419a99.tar.xz
linux-dev-c8113756ba27298d6e95403c087dc5881b419a99.zip
habanalabs: fix DRAM usage accounting on context tear down
The patch fix the DRAM usage accounting by adding a missing update of the DRAM memory consumption, when a context is being torn down without an organized release of the allocated memory. Signed-off-by: Tomer Tayar <ttayar@habana.ai> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/memory.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/memory.c b/drivers/misc/habanalabs/memory.c
index 42d237cae1dc..365fb0cb8dff 100644
--- a/drivers/misc/habanalabs/memory.c
+++ b/drivers/misc/habanalabs/memory.c
@@ -1629,6 +1629,8 @@ void hl_vm_ctx_fini(struct hl_ctx *ctx)
dev_dbg(hdev->dev,
"page list 0x%p of asid %d is still alive\n",
phys_pg_list, ctx->asid);
+ atomic64_sub(phys_pg_list->total_size,
+ &hdev->dram_used_mem);
free_phys_pg_pack(hdev, phys_pg_list);
idr_remove(&vm->phys_pg_pack_handles, i);
}