mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 08:31:55 +00:00
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: ff5f643de0
("drm/imagination: Add GEM and VM related code")
Cc: stable@vger.kernel.org
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Link: https://patchwork.freedesktop.org/patch/msgid/35867394-d8ce-4698-a8fd-919a018f1583@imgtec.com
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
This commit is contained in:
parent
f33b9ab049
commit
3f6b2f60b4
@ -114,6 +114,8 @@ struct pvr_vm_gpuva {
|
|||||||
struct drm_gpuva base;
|
struct drm_gpuva base;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define to_pvr_vm_gpuva(va) container_of_const(va, struct pvr_vm_gpuva, base)
|
||||||
|
|
||||||
enum pvr_vm_bind_type {
|
enum pvr_vm_bind_type {
|
||||||
PVR_VM_BIND_TYPE_MAP,
|
PVR_VM_BIND_TYPE_MAP,
|
||||||
PVR_VM_BIND_TYPE_UNMAP,
|
PVR_VM_BIND_TYPE_UNMAP,
|
||||||
@ -386,6 +388,7 @@ pvr_vm_gpuva_unmap(struct drm_gpuva_op *op, void *op_ctx)
|
|||||||
|
|
||||||
drm_gpuva_unmap(&op->unmap);
|
drm_gpuva_unmap(&op->unmap);
|
||||||
drm_gpuva_unlink(op->unmap.va);
|
drm_gpuva_unlink(op->unmap.va);
|
||||||
|
kfree(to_pvr_vm_gpuva(op->unmap.va));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -433,6 +436,7 @@ pvr_vm_gpuva_remap(struct drm_gpuva_op *op, void *op_ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
drm_gpuva_unlink(op->remap.unmap->va);
|
drm_gpuva_unlink(op->remap.unmap->va);
|
||||||
|
kfree(to_pvr_vm_gpuva(op->remap.unmap->va));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user