diff options
| author | Lyude Paul <lyude@redhat.com> | 2025-09-11 18:57:39 -0400 |
|---|---|---|
| committer | Lyude Paul <lyude@redhat.com> | 2025-09-12 19:04:37 -0400 |
| commit | c08c931060c7e44452e635e115913dd88214848c (patch) | |
| tree | 9cc54727a2c9170568cf3f7db733c7832959deec /drivers/gpu/drm/amd/amdgpu/atom.c | |
| parent | e3f4bdaf2c5bfebcfb483a8caa1fb989ec042e5b (diff) | |
drm/gem/shmem: Extract drm_gem_shmem_release() from drm_gem_shmem_free()
At the moment, the way that we currently free gem shmem objects is not
ideal for rust bindings. drm_gem_shmem_free() releases all of the
associated memory with a gem shmem object with kfree(), which means that
for us to correctly release a gem shmem object in rust we have to manually
drop all of the contents of our gem object structure in-place by hand
before finally calling drm_gem_shmem_free() to release the shmem resources
and the allocation for the gem object.
Since the only reason this is an issue is because of drm_gem_shmem_free()
calling kfree(), we can fix this by splitting drm_gem_shmem_free() out into
itself and drm_gem_shmem_release(), where drm_gem_shmem_release() releases
the various gem shmem resources without freeing the structure itself. With
this, we can safely re-acquire the KBox for the gem object's memory
allocation and let rust handle cleaning up all of the other struct members
automatically.
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://lore.kernel.org/r/20250911230147.650077-3-lyude@redhat.com
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/atom.c')
0 files changed, 0 insertions, 0 deletions