psi: Improve ftrace events

Improve readability of logs by converting hex values to decimal,
and printing memstall deltas instead of absolute values.

Change-Id: I43f21dd9817b540184ce05fd7151459d3502ea28
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Patrick Daly 2019-07-03 17:42:05 -07:00 • committed by Isaac J. Manjarres
commit 06c992a215
2 changed files with 25 additions and 15 deletions

View file

@ -14,13 +14,14 @@
TRACE_EVENT(psi_window_vmstat,
TP_PROTO(u64 memstall, const char *zone_name, u64 high,
TP_PROTO(u64 mem_some, u64 mem_full, const char *zone_name, u64 high,
u64 free, u64 cma, u64 file),
TP_ARGS(memstall, zone_name, high, free, cma, file),
TP_ARGS(mem_some, mem_full, zone_name, high, free, cma, file),
TP_STRUCT__entry(
__field(u64, memstall)
__field(u64, mem_some)
__field(u64, mem_full)
__string(name, zone_name)
__field(u64, high)
__field(u64, free)
@ -29,7 +30,8 @@ TRACE_EVENT(psi_window_vmstat,
),
TP_fast_assign(
__entry->memstall = memstall;
__entry->mem_some = mem_some;
__entry->mem_full = mem_full;
__assign_str(name, zone_name);
__entry->high = high;
__entry->free = free;
@ -37,9 +39,9 @@ TRACE_EVENT(psi_window_vmstat,
__entry->file = file;
),
TP_printk("%16s: Memstall: %#16llx High: %#8llx Free: %#8llx CMA: %#8llx File: %#8llx",
__get_str(name), __entry->memstall, __entry->high,
__entry->free, __entry->cma, __entry->file
TP_printk("%16s: MEMSOME: %9lluns MEMFULL: %9lluns High: %9llukB Free: %9llukB CMA: %8llukB File: %9llukB",
__get_str(name), __entry->mem_some, __entry->mem_full,
__entry->high, __entry->free, __entry->cma, __entry->file
)
);

View file

@ -445,6 +445,9 @@ static void psi_avgs_work(struct work_struct *work)
}
#ifdef CONFIG_PSI_FTRACE
#define TOKB(x) ((x) * (PAGE_SIZE / 1024))
static void trace_event_helper(struct psi_group *group)
{
struct zone *zone;
@ -452,17 +455,22 @@ static void trace_event_helper(struct psi_group *group)
unsigned long free;
unsigned long cma;
unsigned long file;
u64 memstall = group->total[PSI_POLL][PSI_MEM_SOME];
u64 mem_some_delta = group->total[PSI_POLL][PSI_MEM_SOME] -
group->polling_total[PSI_MEM_SOME];
u64 mem_full_delta = group->total[PSI_POLL][PSI_MEM_FULL] -
group->polling_total[PSI_MEM_FULL];
for_each_populated_zone(zone) {
wmark = high_wmark_pages(zone);
free = zone_page_state(zone, NR_FREE_PAGES);
cma = zone_page_state(zone, NR_FREE_CMA_PAGES);
file = zone_page_state(zone, NR_ZONE_ACTIVE_FILE) +
zone_page_state(zone, NR_ZONE_INACTIVE_FILE);
wmark = TOKB(high_wmark_pages(zone));
free = TOKB(zone_page_state(zone, NR_FREE_PAGES));
cma = TOKB(zone_page_state(zone, NR_FREE_CMA_PAGES));
file = TOKB(zone_page_state(zone, NR_ZONE_ACTIVE_FILE) +
zone_page_state(zone, NR_ZONE_INACTIVE_FILE));
trace_psi_window_vmstat(
memstall, zone->name, wmark, free, cma, file);
mem_some_delta, mem_full_delta, zone->name, wmark,
free, cma, file);
}
}
#else
@ -571,6 +579,7 @@ static u64 update_triggers(struct psi_group *group, u64 now)
t->last_event_time = now;
}
trace_event_helper(group);
if (new_stall)
memcpy(group->polling_total, total,
sizeof(group->polling_total));
@ -637,7 +646,6 @@ static void psi_poll_work(struct kthread_work *work)
*/
group->polling_until = now +
group->poll_min_period * UPDATES_PER_WINDOW;
trace_event_helper(group);
}
if (now > group->polling_until) {