Commit f48f3563 authored by Rob Clark's avatar Rob Clark

drm/msm: Add $debugfs/gem stats on resident objects

Currently nearly everything, other than newly allocated objects which
are not yet backed by pages, is pinned and resident in RAM.  But it will
be nice to have some stats on what is unpinned once that is supported.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Link: https://lore.kernel.org/r/20210405174532.1441497-6-robdclark@gmail.comSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 20d0ae2f
...@@ -902,6 +902,11 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, ...@@ -902,6 +902,11 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m,
stats->active.size += obj->size; stats->active.size += obj->size;
} }
if (msm_obj->pages) {
stats->resident.count++;
stats->resident.size += obj->size;
}
switch (msm_obj->madv) { switch (msm_obj->madv) {
case __MSM_MADV_PURGED: case __MSM_MADV_PURGED:
stats->purged.count++; stats->purged.count++;
...@@ -991,6 +996,8 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m) ...@@ -991,6 +996,8 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m)
stats.all.count, stats.all.size); stats.all.count, stats.all.size);
seq_printf(m, "Active: %4d objects, %9zu bytes\n", seq_printf(m, "Active: %4d objects, %9zu bytes\n",
stats.active.count, stats.active.size); stats.active.count, stats.active.size);
seq_printf(m, "Resident: %4d objects, %9zu bytes\n",
stats.resident.count, stats.resident.size);
seq_printf(m, "Purgeable: %4d objects, %9zu bytes\n", seq_printf(m, "Purgeable: %4d objects, %9zu bytes\n",
stats.purgeable.count, stats.purgeable.size); stats.purgeable.count, stats.purgeable.size);
seq_printf(m, "Purged: %4d objects, %9zu bytes\n", seq_printf(m, "Purged: %4d objects, %9zu bytes\n",
......
...@@ -162,13 +162,13 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, ...@@ -162,13 +162,13 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,
struct dma_buf *dmabuf, struct sg_table *sgt); struct dma_buf *dmabuf, struct sg_table *sgt);
__printf(2, 3) __printf(2, 3)
void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...); void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...);
#ifdef CONFIG_DEBUG_FS
#ifdef CONFIG_DEBUG_FS
struct msm_gem_stats { struct msm_gem_stats {
struct { struct {
unsigned count; unsigned count;
size_t size; size_t size;
} all, active, purgeable, purged; } all, active, resident, purgeable, purged;
}; };
void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment