sched: restore discarded ifdef CONFIG_SCHED_WALT code

Code closed in ifdef CONFIG_SCHED_WALT blocks is not used in
msm-4.4 builds, hence in order to be as much as closer to
upstream and subsequently to have less merge conflicts in the
future, let's restore this code.

Restore below CONFIG_SCHED_WALT changes in file [1]:

  3c5c4e9 trace/sched: add rq utilization signal for WALT
  3a29814 sched: fix wrong truncation of walt_avg
  efb86bd sched: Introduce Window Assisted Load Tracking (WALT)

[1] include/trace/events/sched.h

The above changes were discarded during android-4.4 merging
into msm-4.4 starting from change 1758716.

Change-Id: I1dfe59689ee5f1207e0951a8362a497a8c67c6a7
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
This commit is contained in:
Blagovest Kolenichev 2017-10-27 05:38:12 -07:00
parent 2db878d52e
commit 7ed4cfd83b

View file

@ -1851,6 +1851,156 @@ TRACE_EVENT(sched_overutilized,
TP_printk("overutilized=%d",
__entry->overutilized ? 1 : 0)
);
#ifdef CONFIG_SCHED_WALT
struct rq;
TRACE_EVENT(walt_update_task_ravg,
TP_PROTO(struct task_struct *p, struct rq *rq, int evt,
u64 wallclock, u64 irqtime),
TP_ARGS(p, rq, evt, wallclock, irqtime),
TP_STRUCT__entry(
__array( char, comm, TASK_COMM_LEN )
__field( pid_t, pid )
__field( pid_t, cur_pid )
__field(unsigned int, cur_freq )
__field( u64, wallclock )
__field( u64, mark_start )
__field( u64, delta_m )
__field( u64, win_start )
__field( u64, delta )
__field( u64, irqtime )
__field( int, evt )
__field(unsigned int, demand )
__field(unsigned int, sum )
__field( int, cpu )
__field( u64, cs )
__field( u64, ps )
__field(unsigned long, util )
__field( u32, curr_window )
__field( u32, prev_window )
__field( u64, nt_cs )
__field( u64, nt_ps )
__field( u32, active_windows )
),
TP_fast_assign(
__entry->wallclock = wallclock;
__entry->win_start = rq->window_start;
__entry->delta = (wallclock - rq->window_start);
__entry->evt = evt;
__entry->cpu = rq->cpu;
__entry->cur_pid = rq->curr->pid;
__entry->cur_freq = rq->cur_freq;
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
__entry->pid = p->pid;
__entry->mark_start = p->ravg.mark_start;
__entry->delta_m = (wallclock - p->ravg.mark_start);
__entry->demand = p->ravg.demand;
__entry->sum = p->ravg.sum;
__entry->irqtime = irqtime;
__entry->cs = rq->curr_runnable_sum;
__entry->ps = rq->prev_runnable_sum;
__entry->util = rq->prev_runnable_sum << SCHED_LOAD_SHIFT;
do_div(__entry->util, walt_ravg_window);
__entry->curr_window = p->ravg.curr_window;
__entry->prev_window = p->ravg.prev_window;
__entry->nt_cs = rq->nt_curr_runnable_sum;
__entry->nt_ps = rq->nt_prev_runnable_sum;
__entry->active_windows = p->ravg.active_windows;
),
TP_printk("wc %llu ws %llu delta %llu event %d cpu %d cur_freq %u cur_pid %d task %d (%s) ms %llu delta %llu demand %u sum %u irqtime %llu"
" cs %llu ps %llu util %lu cur_window %u prev_window %u active_wins %u"
, __entry->wallclock, __entry->win_start, __entry->delta,
__entry->evt, __entry->cpu,
__entry->cur_freq, __entry->cur_pid,
__entry->pid, __entry->comm, __entry->mark_start,
__entry->delta_m, __entry->demand,
__entry->sum, __entry->irqtime,
__entry->cs, __entry->ps, __entry->util,
__entry->curr_window, __entry->prev_window,
__entry->active_windows
)
);
TRACE_EVENT(walt_update_history,
TP_PROTO(struct rq *rq, struct task_struct *p, u32 runtime, int samples,
int evt),
TP_ARGS(rq, p, runtime, samples, evt),
TP_STRUCT__entry(
__array( char, comm, TASK_COMM_LEN )
__field( pid_t, pid )
__field(unsigned int, runtime )
__field( int, samples )
__field( int, evt )
__field( u64, demand )
__field( u64, walt_avg )
__field(unsigned int, pelt_avg )
__array( u32, hist, RAVG_HIST_SIZE_MAX)
__field( int, cpu )
),
TP_fast_assign(
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
__entry->pid = p->pid;
__entry->runtime = runtime;
__entry->samples = samples;
__entry->evt = evt;
__entry->demand = p->ravg.demand;
__entry->walt_avg = (__entry->demand << 10) / walt_ravg_window,
__entry->pelt_avg = p->se.avg.util_avg;
memcpy(__entry->hist, p->ravg.sum_history,
RAVG_HIST_SIZE_MAX * sizeof(u32));
__entry->cpu = rq->cpu;
),
TP_printk("%d (%s): runtime %u samples %d event %d demand %llu"
" walt %llu pelt %u (hist: %u %u %u %u %u) cpu %d",
__entry->pid, __entry->comm,
__entry->runtime, __entry->samples, __entry->evt,
__entry->demand,
__entry->walt_avg,
__entry->pelt_avg,
__entry->hist[0], __entry->hist[1],
__entry->hist[2], __entry->hist[3],
__entry->hist[4], __entry->cpu)
);
TRACE_EVENT(walt_migration_update_sum,
TP_PROTO(struct rq *rq, struct task_struct *p),
TP_ARGS(rq, p),
TP_STRUCT__entry(
__field(int, cpu )
__field(int, pid )
__field( u64, cs )
__field( u64, ps )
__field( s64, nt_cs )
__field( s64, nt_ps )
),
TP_fast_assign(
__entry->cpu = cpu_of(rq);
__entry->cs = rq->curr_runnable_sum;
__entry->ps = rq->prev_runnable_sum;
__entry->nt_cs = (s64)rq->nt_curr_runnable_sum;
__entry->nt_ps = (s64)rq->nt_prev_runnable_sum;
__entry->pid = p->pid;
),
TP_printk("cpu %d: cs %llu ps %llu nt_cs %lld nt_ps %lld pid %d",
__entry->cpu, __entry->cs, __entry->ps,
__entry->nt_cs, __entry->nt_ps, __entry->pid)
);
#endif /* CONFIG_SCHED_WALT */
#endif /* CONFIG_SMP */