Commit dd2f0d78 authored by Rob Clark's avatar Rob Clark

drm/msm/gem: Consolidate shrinker trace

Combine separate trace events for purge vs evict into one.  When we add
support for purging/evicting active buffers we'll just add more info
into this one trace event, rather than adding a bunch more events.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/496133/
Link: https://lore.kernel.org/r/20220802155152.1727594-13-robdclark@gmail.com
parent f371bcc0
......@@ -71,25 +71,20 @@ msm_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
struct msm_drm_private *priv =
container_of(shrinker, struct msm_drm_private, shrinker);
long nr = sc->nr_to_scan;
unsigned long freed;
unsigned long freed, purged, evicted = 0;
freed = drm_gem_lru_scan(&priv->lru.dontneed, nr, purge);
nr -= freed;
if (freed > 0)
trace_msm_gem_purge(freed << PAGE_SHIFT);
purged = drm_gem_lru_scan(&priv->lru.dontneed, nr, purge);
nr -= purged;
if (can_swap() && nr > 0) {
unsigned long evicted;
evicted = drm_gem_lru_scan(&priv->lru.willneed, nr, evict);
nr -= evicted;
}
if (evicted > 0)
trace_msm_gem_evict(evicted << PAGE_SHIFT);
freed = purged + evicted;
freed += evicted;
}
if (freed)
trace_msm_gem_shrink(sc->nr_to_scan, purged, evicted);
return (freed > 0) ? freed : SHRINK_STOP;
}
......
......@@ -115,29 +115,23 @@ TRACE_EVENT(msm_gmu_freq_change,
);
TRACE_EVENT(msm_gem_purge,
TP_PROTO(u32 bytes),
TP_ARGS(bytes),
TRACE_EVENT(msm_gem_shrink,
TP_PROTO(u32 nr_to_scan, u32 purged, u32 evicted),
TP_ARGS(nr_to_scan, purged, evicted),
TP_STRUCT__entry(
__field(u32, bytes)
__field(u32, nr_to_scan)
__field(u32, purged)
__field(u32, evicted)
),
TP_fast_assign(
__entry->bytes = bytes;
__entry->nr_to_scan = nr_to_scan;
__entry->purged = purged;
__entry->evicted = evicted;
),
TP_printk("Purging %u bytes", __entry->bytes)
);
TRACE_EVENT(msm_gem_evict,
TP_PROTO(u32 bytes),
TP_ARGS(bytes),
TP_STRUCT__entry(
__field(u32, bytes)
),
TP_fast_assign(
__entry->bytes = bytes;
),
TP_printk("Evicting %u bytes", __entry->bytes)
TP_printk("nr_to_scan=%u pages, purged=%u pages, evicted=%u pages",
__entry->nr_to_scan,
__entry->purged,
__entry->evicted)
);
......
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