Revert "ANDROID: Track per-process dmabuf PSS"
Revert submission 3680024 Reason for revert: replacing with a fixed version Reverted changes: /q/submissionid:3680024 Bug: 430499939 Change-Id: Iabc974ee2bd75a88e8e3b4728dc0f1a58ecfe75c Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
@@ -115,9 +115,6 @@ static void dma_buf_release(struct dentry *dentry)
|
|||||||
if (dmabuf->resv == (struct dma_resv *)&dmabuf[1])
|
if (dmabuf->resv == (struct dma_resv *)&dmabuf[1])
|
||||||
dma_resv_fini(dmabuf->resv);
|
dma_resv_fini(dmabuf->resv);
|
||||||
|
|
||||||
if (atomic64_read(&dmabuf->num_unique_refs))
|
|
||||||
pr_err("destroying dmabuf with non-zero task refs\n");
|
|
||||||
|
|
||||||
WARN_ON(!list_empty(&dmabuf->attachments));
|
WARN_ON(!list_empty(&dmabuf->attachments));
|
||||||
module_put(dmabuf->owner);
|
module_put(dmabuf->owner);
|
||||||
kfree(dmabuf->name);
|
kfree(dmabuf->name);
|
||||||
@@ -202,8 +199,6 @@ static int new_task_dmabuf_record(struct task_struct *task, struct dma_buf *dmab
|
|||||||
rec->refcnt = 1;
|
rec->refcnt = 1;
|
||||||
list_add(&rec->node, &task->dmabuf_info->dmabufs);
|
list_add(&rec->node, &task->dmabuf_info->dmabufs);
|
||||||
|
|
||||||
atomic64_inc(&dmabuf->num_unique_refs);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +276,6 @@ void dma_buf_unaccount_task(struct dma_buf *dmabuf, struct task_struct *task)
|
|||||||
list_del(&rec->node);
|
list_del(&rec->node);
|
||||||
kfree(rec);
|
kfree(rec);
|
||||||
task->dmabuf_info->rss -= dmabuf->size;
|
task->dmabuf_info->rss -= dmabuf->size;
|
||||||
atomic64_dec(&dmabuf->num_unique_refs);
|
|
||||||
}
|
}
|
||||||
err:
|
err:
|
||||||
spin_unlock(&task->dmabuf_info->lock);
|
spin_unlock(&task->dmabuf_info->lock);
|
||||||
@@ -857,8 +851,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
|
|||||||
dmabuf->resv = resv;
|
dmabuf->resv = resv;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic64_set(&dmabuf->num_unique_refs, 0);
|
|
||||||
|
|
||||||
file->private_data = dmabuf;
|
file->private_data = dmabuf;
|
||||||
file->f_path.dentry->d_fsdata = dmabuf;
|
file->f_path.dentry->d_fsdata = dmabuf;
|
||||||
dmabuf->file = file;
|
dmabuf->file = file;
|
||||||
|
@@ -3397,39 +3397,6 @@ static const struct file_operations proc_dmabuf_rss_hwm_operations = {
|
|||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int proc_dmabuf_pss_show(struct seq_file *m, struct pid_namespace *ns,
|
|
||||||
struct pid *pid, struct task_struct *task)
|
|
||||||
{
|
|
||||||
struct task_dma_buf_record *rec;
|
|
||||||
u64 pss = 0;
|
|
||||||
|
|
||||||
if (!task->dmabuf_info) {
|
|
||||||
pr_err("%s dmabuf accounting record was not allocated\n", __func__);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(task->flags & PF_KTHREAD)) {
|
|
||||||
spin_lock(&task->dmabuf_info->lock);
|
|
||||||
list_for_each_entry(rec, &task->dmabuf_info->dmabufs, node) {
|
|
||||||
s64 refs = atomic64_read(&rec->dmabuf->num_unique_refs);
|
|
||||||
|
|
||||||
if (refs <= 0) {
|
|
||||||
pr_err("dmabuf has <= refs %lld\n", refs);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
pss += rec->dmabuf->size / (size_t)refs;
|
|
||||||
}
|
|
||||||
spin_unlock(&task->dmabuf_info->lock);
|
|
||||||
|
|
||||||
seq_printf(m, "%llu\n", pss);
|
|
||||||
} else {
|
|
||||||
seq_puts(m, "0\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3558,7 +3525,6 @@ static const struct pid_entry tgid_base_stuff[] = {
|
|||||||
#ifdef CONFIG_DMA_SHARED_BUFFER
|
#ifdef CONFIG_DMA_SHARED_BUFFER
|
||||||
ONE("dmabuf_rss", S_IRUGO, proc_dmabuf_rss_show),
|
ONE("dmabuf_rss", S_IRUGO, proc_dmabuf_rss_show),
|
||||||
REG("dmabuf_rss_hwm", S_IRUGO|S_IWUSR, proc_dmabuf_rss_hwm_operations),
|
REG("dmabuf_rss_hwm", S_IRUGO|S_IWUSR, proc_dmabuf_rss_hwm_operations),
|
||||||
ONE("dmabuf_pss", S_IRUGO, proc_dmabuf_pss_show),
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/android_kabi.h>
|
#include <linux/android_kabi.h>
|
||||||
#ifndef __GENKSYMS__
|
#ifndef __GENKSYMS__
|
||||||
#include <linux/atomic.h>
|
|
||||||
#include <linux/refcount.h>
|
#include <linux/refcount.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -535,13 +534,6 @@ struct dma_buf {
|
|||||||
} *sysfs_entry;
|
} *sysfs_entry;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @num_unique_refs:
|
|
||||||
*
|
|
||||||
* The number of tasks that reference this buffer. For calculating PSS.
|
|
||||||
*/
|
|
||||||
atomic64_t num_unique_refs;
|
|
||||||
|
|
||||||
ANDROID_KABI_RESERVE(1);
|
ANDROID_KABI_RESERVE(1);
|
||||||
ANDROID_KABI_RESERVE(2);
|
ANDROID_KABI_RESERVE(2);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user