ANDROID: dma-buf: Add vendor hook for deferred dmabuf sysfs stats release

This vendor hook allows for the sysfs activity associated with
dma-buf-sysfs-stats teardowns to be performed asynchronously similar
to how the initialization works.

Bug: 254192604
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Change-Id: Ie076d0f8f67b96a97c71d9e6bf90539ebd9807bf
(cherry picked from commit 549f6fcc90a8a3a2640805bf1753de21a074c17f)
This commit is contained in:
T.J. Mercier
2024-06-17 15:37:23 +08:00
committed by yipeng xiang
parent 952ba0ed61
commit 0d385a5b58
3 changed files with 29 additions and 2 deletions
+7 -2
View File
@@ -12,6 +12,7 @@
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/workqueue.h>
#include <trace/hooks/dmabuf.h>
#include "dma-buf-sysfs-stats.h"
@@ -122,13 +123,17 @@ static const struct kobj_type dma_buf_ktype = {
void dma_buf_stats_teardown(struct dma_buf *dmabuf)
{
struct dma_buf_sysfs_entry *sysfs_entry;
bool skip_sysfs_release = false;
sysfs_entry = dmabuf->sysfs_entry;
if (!sysfs_entry)
return;
kobject_del(&sysfs_entry->kobj);
kobject_put(&sysfs_entry->kobj);
trace_android_rvh_dma_buf_stats_teardown(sysfs_entry, &skip_sysfs_release);
if (!skip_sysfs_release) {
kobject_del(&sysfs_entry->kobj);
kobject_put(&sysfs_entry->kobj);
}
}