Skip to content

Commit 3f6b2f6

Browse files
committed
drm/imagination: Free pvr_vm_gpuva after unlink
This caused a measurable memory leak. Although the individual allocations are small, the leaks occurs in a high-usage codepath (remapping or unmapping device memory) so they add up quickly. Fixes: ff5f643 ("drm/imagination: Add GEM and VM related code") Cc: [email protected] Reviewed-by: Frank Binns <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Matt Coster <[email protected]>
1 parent f33b9ab commit 3f6b2f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/gpu/drm/imagination/pvr_vm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ struct pvr_vm_gpuva {
114114
struct drm_gpuva base;
115115
};
116116

117+
#define to_pvr_vm_gpuva(va) container_of_const(va, struct pvr_vm_gpuva, base)
118+
117119
enum pvr_vm_bind_type {
118120
PVR_VM_BIND_TYPE_MAP,
119121
PVR_VM_BIND_TYPE_UNMAP,
@@ -386,6 +388,7 @@ pvr_vm_gpuva_unmap(struct drm_gpuva_op *op, void *op_ctx)
386388

387389
drm_gpuva_unmap(&op->unmap);
388390
drm_gpuva_unlink(op->unmap.va);
391+
kfree(to_pvr_vm_gpuva(op->unmap.va));
389392

390393
return 0;
391394
}
@@ -433,6 +436,7 @@ pvr_vm_gpuva_remap(struct drm_gpuva_op *op, void *op_ctx)
433436
}
434437

435438
drm_gpuva_unlink(op->remap.unmap->va);
439+
kfree(to_pvr_vm_gpuva(op->remap.unmap->va));
436440

437441
return 0;
438442
}

0 commit comments

Comments
 (0)