blob: bbcb3d5fac2c66f63627bdf7f6d95b93e226a71a [file] [log] [blame]
Li Zefand0b6e042009-07-13 10:33:21 +08001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM sched
3
Steven Rostedtea20d922009-04-10 08:54:16 -04004#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
Mathieu Desnoyers0a16b602008-07-18 12:16:17 -04005#define _TRACE_SCHED_H
6
7#include <linux/sched.h>
8#include <linux/tracepoint.h>
David Smith4ff16c22012-02-07 10:11:05 -06009#include <linux/binfmts.h>
Mathieu Desnoyers0a16b602008-07-18 12:16:17 -040010
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -070011struct rq;
12
Steven Rostedtea20d922009-04-10 08:54:16 -040013/*
14 * Tracepoint for calling kthread_stop, performed to end a kthread:
15 */
16TRACE_EVENT(sched_kthread_stop,
17
18 TP_PROTO(struct task_struct *t),
19
20 TP_ARGS(t),
21
22 TP_STRUCT__entry(
23 __array( char, comm, TASK_COMM_LEN )
24 __field( pid_t, pid )
25 ),
26
27 TP_fast_assign(
28 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
29 __entry->pid = t->pid;
30 ),
31
Ingo Molnar434a83c2009-10-15 11:50:39 +020032 TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid)
Steven Rostedtea20d922009-04-10 08:54:16 -040033);
34
35/*
36 * Tracepoint for the return value of the kthread stopping:
37 */
38TRACE_EVENT(sched_kthread_stop_ret,
39
40 TP_PROTO(int ret),
41
42 TP_ARGS(ret),
43
44 TP_STRUCT__entry(
45 __field( int, ret )
46 ),
47
48 TP_fast_assign(
49 __entry->ret = ret;
50 ),
51
Ingo Molnar434a83c2009-10-15 11:50:39 +020052 TP_printk("ret=%d", __entry->ret)
Steven Rostedtea20d922009-04-10 08:54:16 -040053);
54
55/*
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -070056 * Tracepoint for task enqueue/dequeue:
57 */
58TRACE_EVENT(sched_enq_deq_task,
59
60 TP_PROTO(struct task_struct *p, bool enqueue, unsigned int cpus_allowed),
61
62 TP_ARGS(p, enqueue, cpus_allowed),
63
64 TP_STRUCT__entry(
65 __array( char, comm, TASK_COMM_LEN )
66 __field( pid_t, pid )
67 __field( int, prio )
68 __field( int, cpu )
69 __field( bool, enqueue )
70 __field(unsigned int, nr_running )
71 __field(unsigned long, cpu_load )
72 __field(unsigned int, rt_nr_running )
73 __field(unsigned int, cpus_allowed )
Puja Gupta487dec62017-06-27 10:13:50 -070074#ifdef CONFIG_SCHED_WALT
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -070075 __field(unsigned int, demand )
76 __field(unsigned int, pred_demand )
77#endif
78 ),
79
80 TP_fast_assign(
81 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
82 __entry->pid = p->pid;
83 __entry->prio = p->prio;
84 __entry->cpu = task_cpu(p);
85 __entry->enqueue = enqueue;
86 __entry->nr_running = task_rq(p)->nr_running;
87 __entry->cpu_load = task_rq(p)->cpu_load[0];
88 __entry->rt_nr_running = task_rq(p)->rt.rt_nr_running;
89 __entry->cpus_allowed = cpus_allowed;
Puja Gupta487dec62017-06-27 10:13:50 -070090#ifdef CONFIG_SCHED_WALT
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -070091 __entry->demand = p->ravg.demand;
92 __entry->pred_demand = p->ravg.pred_demand;
93#endif
94 ),
95
96 TP_printk("cpu=%d %s comm=%s pid=%d prio=%d nr_running=%u cpu_load=%lu rt_nr_running=%u affine=%x"
Puja Gupta487dec62017-06-27 10:13:50 -070097#ifdef CONFIG_SCHED_WALT
98 " demand=%u pred_demand=%u"
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -070099#endif
100 , __entry->cpu,
101 __entry->enqueue ? "enqueue" : "dequeue",
102 __entry->comm, __entry->pid,
103 __entry->prio, __entry->nr_running,
104 __entry->cpu_load, __entry->rt_nr_running, __entry->cpus_allowed
Puja Gupta487dec62017-06-27 10:13:50 -0700105#ifdef CONFIG_SCHED_WALT
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700106 , __entry->demand, __entry->pred_demand
107#endif
108 )
109);
110
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800111#ifdef CONFIG_SCHED_WALT
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700112struct group_cpu_time;
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700113extern const char *task_event_names[];
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700114
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800115#if defined(CREATE_TRACE_POINTS) && defined(CONFIG_SCHED_WALT)
Syed Rameez Mustafa60cef212016-05-09 16:28:07 -0700116static inline void __window_data(u32 *dst, u32 *src)
117{
118 if (src)
119 memcpy(dst, src, nr_cpu_ids * sizeof(u32));
120 else
121 memset(dst, 0, nr_cpu_ids * sizeof(u32));
122}
123
124struct trace_seq;
125const char *__window_print(struct trace_seq *p, const u32 *buf, int buf_len)
126{
127 int i;
128 const char *ret = p->buffer + seq_buf_used(&p->seq);
129
130 for (i = 0; i < buf_len; i++)
131 trace_seq_printf(p, "%u ", buf[i]);
132
133 trace_seq_putc(p, 0);
134
135 return ret;
136}
Pavankumar Kondeti6deb2c42017-01-09 13:56:33 +0530137
138static inline s64 __rq_update_sum(struct rq *rq, bool curr, bool new)
139{
140 if (curr)
141 if (new)
142 return rq->nt_curr_runnable_sum;
143 else
144 return rq->curr_runnable_sum;
145 else
146 if (new)
147 return rq->nt_prev_runnable_sum;
148 else
149 return rq->prev_runnable_sum;
150}
151
152static inline s64 __grp_update_sum(struct rq *rq, bool curr, bool new)
153{
154 if (curr)
155 if (new)
156 return rq->grp_time.nt_curr_runnable_sum;
157 else
158 return rq->grp_time.curr_runnable_sum;
159 else
160 if (new)
161 return rq->grp_time.nt_prev_runnable_sum;
162 else
163 return rq->grp_time.prev_runnable_sum;
164}
165
166static inline s64
167__get_update_sum(struct rq *rq, enum migrate_types migrate_type,
168 bool src, bool new, bool curr)
169{
170 switch (migrate_type) {
171 case RQ_TO_GROUP:
172 if (src)
173 return __rq_update_sum(rq, curr, new);
174 else
175 return __grp_update_sum(rq, curr, new);
176 case GROUP_TO_RQ:
177 if (src)
178 return __grp_update_sum(rq, curr, new);
179 else
180 return __rq_update_sum(rq, curr, new);
181 default:
182 WARN_ON_ONCE(1);
183 return -1;
184 }
185}
Syed Rameez Mustafa60cef212016-05-09 16:28:07 -0700186#endif
187
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800188TRACE_EVENT(sched_update_pred_demand,
189
190 TP_PROTO(struct rq *rq, struct task_struct *p, u32 runtime, int pct,
191 unsigned int pred_demand),
192
193 TP_ARGS(rq, p, runtime, pct, pred_demand),
194
195 TP_STRUCT__entry(
196 __array( char, comm, TASK_COMM_LEN )
197 __field( pid_t, pid )
198 __field(unsigned int, runtime )
199 __field( int, pct )
200 __field(unsigned int, pred_demand )
201 __array( u8, bucket, NUM_BUSY_BUCKETS)
202 __field( int, cpu )
203 ),
204
205 TP_fast_assign(
206 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
207 __entry->pid = p->pid;
208 __entry->runtime = runtime;
209 __entry->pct = pct;
210 __entry->pred_demand = pred_demand;
211 memcpy(__entry->bucket, p->ravg.busy_buckets,
212 NUM_BUSY_BUCKETS * sizeof(u8));
213 __entry->cpu = rq->cpu;
214 ),
215
216 TP_printk("%d (%s): runtime %u pct %d cpu %d pred_demand %u (buckets: %u %u %u %u %u %u %u %u %u %u)",
217 __entry->pid, __entry->comm,
218 __entry->runtime, __entry->pct, __entry->cpu,
219 __entry->pred_demand, __entry->bucket[0], __entry->bucket[1],
220 __entry->bucket[2], __entry->bucket[3],__entry->bucket[4],
221 __entry->bucket[5], __entry->bucket[6], __entry->bucket[7],
222 __entry->bucket[8], __entry->bucket[9])
223);
224
225TRACE_EVENT(sched_update_history,
226
227 TP_PROTO(struct rq *rq, struct task_struct *p, u32 runtime, int samples,
228 enum task_event evt),
229
230 TP_ARGS(rq, p, runtime, samples, evt),
231
232 TP_STRUCT__entry(
233 __array( char, comm, TASK_COMM_LEN )
234 __field( pid_t, pid )
235 __field(unsigned int, runtime )
236 __field( int, samples )
237 __field(enum task_event, evt )
238 __field(unsigned int, demand )
Syed Rameez Mustafaf3f7bf82017-04-11 17:43:48 -0700239 __field(unsigned int, coloc_demand )
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800240 __field(unsigned int, pred_demand )
241 __array( u32, hist, RAVG_HIST_SIZE_MAX)
242 __field(unsigned int, nr_big_tasks )
243 __field( int, cpu )
244 ),
245
246 TP_fast_assign(
247 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
248 __entry->pid = p->pid;
249 __entry->runtime = runtime;
250 __entry->samples = samples;
251 __entry->evt = evt;
252 __entry->demand = p->ravg.demand;
Syed Rameez Mustafaf3f7bf82017-04-11 17:43:48 -0700253 __entry->coloc_demand = p->ravg.coloc_demand;
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800254 __entry->pred_demand = p->ravg.pred_demand;
255 memcpy(__entry->hist, p->ravg.sum_history,
256 RAVG_HIST_SIZE_MAX * sizeof(u32));
257 __entry->nr_big_tasks = rq->hmp_stats.nr_big_tasks;
258 __entry->cpu = rq->cpu;
259 ),
260
Syed Rameez Mustafaf3f7bf82017-04-11 17:43:48 -0700261 TP_printk("%d (%s): runtime %u samples %d event %s demand %u coloc_demand %u pred_demand %u"
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800262 " (hist: %u %u %u %u %u) cpu %d nr_big %u",
263 __entry->pid, __entry->comm,
264 __entry->runtime, __entry->samples,
265 task_event_names[__entry->evt],
Syed Rameez Mustafaf3f7bf82017-04-11 17:43:48 -0700266 __entry->demand, __entry->coloc_demand, __entry->pred_demand,
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800267 __entry->hist[0], __entry->hist[1],
268 __entry->hist[2], __entry->hist[3],
269 __entry->hist[4], __entry->cpu, __entry->nr_big_tasks)
270);
271
272TRACE_EVENT(sched_get_task_cpu_cycles,
273
274 TP_PROTO(int cpu, int event, u64 cycles, u64 exec_time),
275
276 TP_ARGS(cpu, event, cycles, exec_time),
277
278 TP_STRUCT__entry(
279 __field(int, cpu )
280 __field(int, event )
281 __field(u64, cycles )
282 __field(u64, exec_time )
283 __field(u32, freq )
284 __field(u32, legacy_freq )
285 ),
286
287 TP_fast_assign(
288 __entry->cpu = cpu;
289 __entry->event = event;
290 __entry->cycles = cycles;
291 __entry->exec_time = exec_time;
292 __entry->freq = cpu_cycles_to_freq(cycles, exec_time);
293 __entry->legacy_freq = cpu_cur_freq(cpu);
294 ),
295
296 TP_printk("cpu=%d event=%d cycles=%llu exec_time=%llu freq=%u legacy_freq=%u",
297 __entry->cpu, __entry->event, __entry->cycles,
298 __entry->exec_time, __entry->freq, __entry->legacy_freq)
299);
300
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700301TRACE_EVENT(sched_update_task_ravg,
302
303 TP_PROTO(struct task_struct *p, struct rq *rq, enum task_event evt,
304 u64 wallclock, u64 irqtime, u64 cycles, u64 exec_time,
305 struct group_cpu_time *cpu_time),
306
307 TP_ARGS(p, rq, evt, wallclock, irqtime, cycles, exec_time, cpu_time),
308
309 TP_STRUCT__entry(
310 __array( char, comm, TASK_COMM_LEN )
311 __field( pid_t, pid )
312 __field( pid_t, cur_pid )
313 __field(unsigned int, cur_freq )
314 __field( u64, wallclock )
315 __field( u64, mark_start )
316 __field( u64, delta_m )
317 __field( u64, win_start )
318 __field( u64, delta )
319 __field( u64, irqtime )
320 __field(enum task_event, evt )
321 __field(unsigned int, demand )
Syed Rameez Mustafaf3f7bf82017-04-11 17:43:48 -0700322 __field(unsigned int, coloc_demand )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700323 __field(unsigned int, sum )
324 __field( int, cpu )
325 __field(unsigned int, pred_demand )
326 __field( u64, rq_cs )
327 __field( u64, rq_ps )
328 __field( u64, grp_cs )
329 __field( u64, grp_ps )
Syed Rameez Mustafa60cef212016-05-09 16:28:07 -0700330 __field( u64, grp_nt_cs )
331 __field( u64, grp_nt_ps )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700332 __field( u32, curr_window )
333 __field( u32, prev_window )
Syed Rameez Mustafa60cef212016-05-09 16:28:07 -0700334 __dynamic_array(u32, curr_sum, nr_cpu_ids )
335 __dynamic_array(u32, prev_sum, nr_cpu_ids )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700336 __field( u64, nt_cs )
337 __field( u64, nt_ps )
338 __field( u32, active_windows )
Syed Rameez Mustafa59b5fb72016-05-31 16:40:45 -0700339 __field( u8, curr_top )
340 __field( u8, prev_top )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700341 ),
342
343 TP_fast_assign(
344 __entry->wallclock = wallclock;
345 __entry->win_start = rq->window_start;
346 __entry->delta = (wallclock - rq->window_start);
347 __entry->evt = evt;
348 __entry->cpu = rq->cpu;
349 __entry->cur_pid = rq->curr->pid;
350 __entry->cur_freq = cpu_cycles_to_freq(cycles, exec_time);
351 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
352 __entry->pid = p->pid;
353 __entry->mark_start = p->ravg.mark_start;
354 __entry->delta_m = (wallclock - p->ravg.mark_start);
355 __entry->demand = p->ravg.demand;
Syed Rameez Mustafaf3f7bf82017-04-11 17:43:48 -0700356 __entry->coloc_demand = p->ravg.coloc_demand;
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700357 __entry->sum = p->ravg.sum;
358 __entry->irqtime = irqtime;
359 __entry->pred_demand = p->ravg.pred_demand;
360 __entry->rq_cs = rq->curr_runnable_sum;
361 __entry->rq_ps = rq->prev_runnable_sum;
362 __entry->grp_cs = cpu_time ? cpu_time->curr_runnable_sum : 0;
363 __entry->grp_ps = cpu_time ? cpu_time->prev_runnable_sum : 0;
364 __entry->grp_nt_cs = cpu_time ? cpu_time->nt_curr_runnable_sum : 0;
365 __entry->grp_nt_ps = cpu_time ? cpu_time->nt_prev_runnable_sum : 0;
366 __entry->curr_window = p->ravg.curr_window;
367 __entry->prev_window = p->ravg.prev_window;
Syed Rameez Mustafa60cef212016-05-09 16:28:07 -0700368 __window_data(__get_dynamic_array(curr_sum), p->ravg.curr_window_cpu);
369 __window_data(__get_dynamic_array(prev_sum), p->ravg.prev_window_cpu);
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700370 __entry->nt_cs = rq->nt_curr_runnable_sum;
371 __entry->nt_ps = rq->nt_prev_runnable_sum;
372 __entry->active_windows = p->ravg.active_windows;
Syed Rameez Mustafa59b5fb72016-05-31 16:40:45 -0700373 __entry->curr_top = rq->curr_top;
374 __entry->prev_top = rq->prev_top;
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700375 ),
376
Syed Rameez Mustafaf3f7bf82017-04-11 17:43:48 -0700377 TP_printk("wc %llu ws %llu delta %llu event %s cpu %d cur_freq %u cur_pid %d task %d (%s) ms %llu delta %llu demand %u coloc_demand: %u sum %u irqtime %llu pred_demand %u rq_cs %llu rq_ps %llu cur_window %u (%s) prev_window %u (%s) nt_cs %llu nt_ps %llu active_wins %u grp_cs %lld grp_ps %lld, grp_nt_cs %llu, grp_nt_ps: %llu curr_top %u prev_top %u",
Syed Rameez Mustafa59b5fb72016-05-31 16:40:45 -0700378 __entry->wallclock, __entry->win_start, __entry->delta,
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700379 task_event_names[__entry->evt], __entry->cpu,
380 __entry->cur_freq, __entry->cur_pid,
381 __entry->pid, __entry->comm, __entry->mark_start,
Syed Rameez Mustafaf3f7bf82017-04-11 17:43:48 -0700382 __entry->delta_m, __entry->demand, __entry->coloc_demand,
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700383 __entry->sum, __entry->irqtime, __entry->pred_demand,
384 __entry->rq_cs, __entry->rq_ps, __entry->curr_window,
Syed Rameez Mustafa60cef212016-05-09 16:28:07 -0700385 __window_print(p, __get_dynamic_array(curr_sum), nr_cpu_ids),
386 __entry->prev_window,
387 __window_print(p, __get_dynamic_array(prev_sum), nr_cpu_ids),
388 __entry->nt_cs, __entry->nt_ps,
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700389 __entry->active_windows, __entry->grp_cs,
Syed Rameez Mustafa59b5fb72016-05-31 16:40:45 -0700390 __entry->grp_ps, __entry->grp_nt_cs, __entry->grp_nt_ps,
391 __entry->curr_top, __entry->prev_top)
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700392);
393
Vikram Mulukutla0b062902017-03-20 16:27:04 -0700394TRACE_EVENT(sched_update_task_ravg_mini,
395
396 TP_PROTO(struct task_struct *p, struct rq *rq, enum task_event evt,
397 u64 wallclock, u64 irqtime, u64 cycles, u64 exec_time,
398 struct group_cpu_time *cpu_time),
399
400 TP_ARGS(p, rq, evt, wallclock, irqtime, cycles, exec_time, cpu_time),
401
402 TP_STRUCT__entry(
403 __array( char, comm, TASK_COMM_LEN )
404 __field( pid_t, pid )
405 __field( u64, wallclock )
406 __field( u64, mark_start )
407 __field( u64, delta_m )
408 __field( u64, win_start )
409 __field( u64, delta )
410 __field(enum task_event, evt )
411 __field(unsigned int, demand )
412 __field( int, cpu )
413 __field( u64, rq_cs )
414 __field( u64, rq_ps )
415 __field( u64, grp_cs )
416 __field( u64, grp_ps )
417 __field( u32, curr_window )
418 __field( u32, prev_window )
419 ),
420
421 TP_fast_assign(
422 __entry->wallclock = wallclock;
423 __entry->win_start = rq->window_start;
424 __entry->delta = (wallclock - rq->window_start);
425 __entry->evt = evt;
426 __entry->cpu = rq->cpu;
427 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
428 __entry->pid = p->pid;
429 __entry->mark_start = p->ravg.mark_start;
430 __entry->delta_m = (wallclock - p->ravg.mark_start);
431 __entry->demand = p->ravg.demand;
432 __entry->rq_cs = rq->curr_runnable_sum;
433 __entry->rq_ps = rq->prev_runnable_sum;
434 __entry->grp_cs = cpu_time ? cpu_time->curr_runnable_sum : 0;
435 __entry->grp_ps = cpu_time ? cpu_time->prev_runnable_sum : 0;
436 __entry->curr_window = p->ravg.curr_window;
437 __entry->prev_window = p->ravg.prev_window;
438 ),
439
440 TP_printk("wc %llu ws %llu delta %llu event %s cpu %d task %d (%s) ms %llu delta %llu demand %u rq_cs %llu rq_ps %llu cur_window %u prev_window %u grp_cs %lld grp_ps %lld",
441 __entry->wallclock, __entry->win_start, __entry->delta,
442 task_event_names[__entry->evt], __entry->cpu,
443 __entry->pid, __entry->comm, __entry->mark_start,
444 __entry->delta_m, __entry->demand,
445 __entry->rq_cs, __entry->rq_ps, __entry->curr_window,
446 __entry->prev_window,
447 __entry->grp_cs,
448 __entry->grp_ps)
449);
450
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800451struct migration_sum_data;
452extern const char *migrate_type_names[];
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700453
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800454TRACE_EVENT(sched_set_preferred_cluster,
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700455
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800456 TP_PROTO(struct related_thread_group *grp, u64 total_demand),
457
458 TP_ARGS(grp, total_demand),
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700459
460 TP_STRUCT__entry(
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800461 __field( int, id )
462 __field( u64, demand )
463 __field( int, cluster_first_cpu )
464 __array( char, comm, TASK_COMM_LEN )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700465 __field( pid_t, pid )
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800466 __field(unsigned int, task_demand )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700467 ),
468
469 TP_fast_assign(
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800470 __entry->id = grp->id;
471 __entry->demand = total_demand;
472 __entry->cluster_first_cpu = grp->preferred_cluster ?
473 cluster_first_cpu(grp->preferred_cluster)
474 : -1;
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700475 ),
476
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800477 TP_printk("group_id %d total_demand %llu preferred_cluster_first_cpu %d",
478 __entry->id, __entry->demand,
479 __entry->cluster_first_cpu)
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700480);
481
482TRACE_EVENT(sched_migration_update_sum,
483
Pavankumar Kondeti6deb2c42017-01-09 13:56:33 +0530484 TP_PROTO(struct task_struct *p, enum migrate_types migrate_type, struct rq *rq),
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700485
Pavankumar Kondeti6deb2c42017-01-09 13:56:33 +0530486 TP_ARGS(p, migrate_type, rq),
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700487
488 TP_STRUCT__entry(
489 __field(int, tcpu )
490 __field(int, pid )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700491 __field(enum migrate_types, migrate_type )
492 __field( s64, src_cs )
493 __field( s64, src_ps )
494 __field( s64, dst_cs )
495 __field( s64, dst_ps )
496 __field( s64, src_nt_cs )
497 __field( s64, src_nt_ps )
498 __field( s64, dst_nt_cs )
499 __field( s64, dst_nt_ps )
500 ),
501
502 TP_fast_assign(
503 __entry->tcpu = task_cpu(p);
504 __entry->pid = p->pid;
505 __entry->migrate_type = migrate_type;
Pavankumar Kondeti6deb2c42017-01-09 13:56:33 +0530506 __entry->src_cs = __get_update_sum(rq, migrate_type,
507 true, false, true);
508 __entry->src_ps = __get_update_sum(rq, migrate_type,
509 true, false, false);
510 __entry->dst_cs = __get_update_sum(rq, migrate_type,
511 false, false, true);
512 __entry->dst_ps = __get_update_sum(rq, migrate_type,
513 false, false, false);
514 __entry->src_nt_cs = __get_update_sum(rq, migrate_type,
515 true, true, true);
516 __entry->src_nt_ps = __get_update_sum(rq, migrate_type,
517 true, true, false);
518 __entry->dst_nt_cs = __get_update_sum(rq, migrate_type,
519 false, true, true);
520 __entry->dst_nt_ps = __get_update_sum(rq, migrate_type,
521 false, true, false);
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700522 ),
523
524 TP_printk("pid %d task_cpu %d migrate_type %s src_cs %llu src_ps %llu dst_cs %lld dst_ps %lld src_nt_cs %llu src_nt_ps %llu dst_nt_cs %lld dst_nt_ps %lld",
525 __entry->pid, __entry->tcpu, migrate_type_names[__entry->migrate_type],
526 __entry->src_cs, __entry->src_ps, __entry->dst_cs, __entry->dst_ps,
527 __entry->src_nt_cs, __entry->src_nt_ps, __entry->dst_nt_cs, __entry->dst_nt_ps)
528);
529
Syed Rameez Mustafa20acfe72017-01-30 09:35:46 +0530530TRACE_EVENT(sched_set_boost,
531
532 TP_PROTO(int type),
533
534 TP_ARGS(type),
535
536 TP_STRUCT__entry(
537 __field(int, type )
538 ),
539
540 TP_fast_assign(
541 __entry->type = type;
542 ),
543
544 TP_printk("type %d", __entry->type)
545);
546
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800547#endif
548
549#ifdef CONFIG_SCHED_WALT
550DECLARE_EVENT_CLASS(sched_cpu_load,
551
Puja Gupta487dec62017-06-27 10:13:50 -0700552 TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost),
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800553
Puja Gupta487dec62017-06-27 10:13:50 -0700554 TP_ARGS(rq, idle, irqload, power_cost),
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800555
556 TP_STRUCT__entry(
557 __field(unsigned int, cpu )
558 __field(unsigned int, idle )
559 __field(unsigned int, nr_running )
560 __field(unsigned int, nr_big_tasks )
561 __field(unsigned int, load_scale_factor )
562 __field(unsigned int, capacity )
563 __field( u64, cumulative_runnable_avg )
564 __field( u64, irqload )
565 __field(unsigned int, max_freq )
566 __field(unsigned int, power_cost )
567 __field( int, cstate )
568 __field( int, dstate )
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800569 ),
570
571 TP_fast_assign(
572 __entry->cpu = rq->cpu;
573 __entry->idle = idle;
574 __entry->nr_running = rq->nr_running;
575 __entry->nr_big_tasks = rq->hmp_stats.nr_big_tasks;
576 __entry->load_scale_factor = cpu_load_scale_factor(rq->cpu);
577 __entry->capacity = cpu_capacity(rq->cpu);
578 __entry->cumulative_runnable_avg = rq->hmp_stats.cumulative_runnable_avg;
579 __entry->irqload = irqload;
580 __entry->max_freq = cpu_max_freq(rq->cpu);
581 __entry->power_cost = power_cost;
582 __entry->cstate = rq->cstate;
583 __entry->dstate = rq->cluster->dstate;
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800584 ),
585
Puja Gupta487dec62017-06-27 10:13:50 -0700586 TP_printk("cpu %u idle %d nr_run %u nr_big %u lsf %u capacity %u cr_avg %llu irqload %llu fmax %u power_cost %u cstate %d dstate %d",
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800587 __entry->cpu, __entry->idle, __entry->nr_running, __entry->nr_big_tasks,
588 __entry->load_scale_factor, __entry->capacity,
589 __entry->cumulative_runnable_avg, __entry->irqload,
590 __entry->max_freq, __entry->power_cost, __entry->cstate,
Puja Gupta487dec62017-06-27 10:13:50 -0700591 __entry->dstate)
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800592);
593
594DEFINE_EVENT(sched_cpu_load, sched_cpu_load_lb,
Puja Gupta487dec62017-06-27 10:13:50 -0700595 TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost),
596 TP_ARGS(rq, idle, irqload, power_cost)
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800597);
Vikram Mulukutladb410a42017-07-12 12:34:10 -0700598
599TRACE_EVENT(sched_load_to_gov,
600
601 TP_PROTO(struct rq *rq, u64 aggr_grp_load, u32 tt_load, u64 freq_aggr_thresh, u64 load, int policy),
602 TP_ARGS(rq, aggr_grp_load, tt_load, freq_aggr_thresh, load, policy),
603
604 TP_STRUCT__entry(
605 __field( int, cpu )
606 __field( int, policy )
607 __field( int, ed_task_pid )
608 __field( u64, aggr_grp_load )
609 __field( u64, freq_aggr_thresh )
610 __field( u64, tt_load )
611 __field( u64, rq_ps )
612 __field( u64, grp_rq_ps )
613 __field( u64, nt_ps )
614 __field( u64, grp_nt_ps )
615 __field( u64, pl )
616 __field( u64, load )
617 ),
618
619 TP_fast_assign(
620 __entry->cpu = cpu_of(rq);
621 __entry->policy = policy;
622 __entry->ed_task_pid = rq->ed_task ? rq->ed_task->pid : -1;
623 __entry->aggr_grp_load = aggr_grp_load;
624 __entry->freq_aggr_thresh = freq_aggr_thresh;
625 __entry->tt_load = tt_load;
626 __entry->rq_ps = rq->prev_runnable_sum;
627 __entry->grp_rq_ps = rq->grp_time.prev_runnable_sum;
628 __entry->nt_ps = rq->nt_prev_runnable_sum;
629 __entry->grp_nt_ps = rq->grp_time.nt_prev_runnable_sum;
630 __entry->pl = rq->hmp_stats.pred_demands_sum;
631 __entry->load = load;
632 ),
633
634 TP_printk("cpu=%d policy=%d ed_task_pid=%d aggr_grp_load=%llu freq_aggr_thresh=%llu tt_load=%llu rq_ps=%llu grp_rq_ps=%llu nt_ps=%llu grp_nt_ps=%llu pl=%llu load=%llu",
635 __entry->cpu, __entry->policy, __entry->ed_task_pid,
636 __entry->aggr_grp_load, __entry->freq_aggr_thresh,
637 __entry->tt_load, __entry->rq_ps, __entry->grp_rq_ps,
638 __entry->nt_ps, __entry->grp_nt_ps, __entry->pl, __entry->load)
639);
Joonwoo Parkf7d6cd42017-01-17 15:19:43 -0800640#endif
641
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800642#ifdef CONFIG_SMP
643TRACE_EVENT(sched_cpu_util,
644
Joonwoo Parke19cd6f2017-02-03 14:32:49 -0800645 TP_PROTO(struct task_struct *p, int cpu, int task_util, unsigned long curr_util, unsigned long new_cum_util, int sync),
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800646
Joonwoo Parke19cd6f2017-02-03 14:32:49 -0800647 TP_ARGS(p, cpu, task_util, curr_util, new_cum_util, sync),
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800648
649 TP_STRUCT__entry(
650 __array(char, comm, TASK_COMM_LEN )
651 __field(int, pid )
652 __field(unsigned int, cpu )
653 __field(int, task_util )
654 __field(unsigned int, nr_running )
655 __field(long, cpu_util )
Joonwoo Parke19cd6f2017-02-03 14:32:49 -0800656 __field(long, cpu_util_cum )
657 __field(long, new_cum_util )
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800658 __field(unsigned int, capacity_curr )
659 __field(unsigned int, capacity )
Joonwoo Park449182f2017-01-30 21:04:36 -0800660 __field(unsigned long, curr_util )
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800661 __field(int, sync )
662 __field(int, idle_state )
Joonwoo Park7b211a42017-01-31 18:26:42 -0800663 __field(unsigned int, irqload )
664 __field(int, high_irqload )
Joonwoo Parke19cd6f2017-02-03 14:32:49 -0800665 __field(int, task_in_cum_demand )
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800666 ),
667
668 TP_fast_assign(
669 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
670 __entry->pid = p->pid;
671 __entry->cpu = cpu;
672 __entry->task_util = task_util;
673 __entry->nr_running = cpu_rq(cpu)->nr_running;
674 __entry->cpu_util = cpu_util(cpu);
Joonwoo Parke19cd6f2017-02-03 14:32:49 -0800675 __entry->cpu_util_cum = cpu_util_cum(cpu, 0);
676 __entry->new_cum_util = new_cum_util;
677 __entry->task_in_cum_demand = task_in_cum_window_demand(cpu_rq(cpu), p);
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800678 __entry->capacity_curr = capacity_curr_of(cpu);
679 __entry->capacity = capacity_of(cpu);
Joonwoo Park449182f2017-01-30 21:04:36 -0800680 __entry->curr_util = curr_util;
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800681 __entry->sync = sync;
682 __entry->idle_state = idle_get_state_idx(cpu_rq(cpu));
Joonwoo Park7b211a42017-01-31 18:26:42 -0800683 __entry->irqload = sched_irqload(cpu);
684 __entry->high_irqload = sched_cpu_high_irqload(cpu);
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800685 ),
686
Joonwoo Parke19cd6f2017-02-03 14:32:49 -0800687 TP_printk("comm=%s pid=%d cpu=%d task_util=%d nr_running=%d cpu_util=%ld cpu_util_cum=%ld new_cum_util=%ld task_in_cum=%d capacity_curr=%u capacity=%u curr_util=%ld sync=%d idle_state=%d irqload=%u high_irqload=%u",
688 __entry->comm, __entry->pid, __entry->cpu, __entry->task_util, __entry->nr_running, __entry->cpu_util, __entry->cpu_util_cum, __entry->new_cum_util, __entry->task_in_cum_demand, __entry->capacity_curr, __entry->capacity, __entry->curr_util, __entry->sync, __entry->idle_state, __entry->irqload, __entry->high_irqload)
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800689);
690
Joonwoo Park6939ca62017-02-17 22:17:51 -0800691TRACE_EVENT(sched_energy_diff_packing,
692
693 TP_PROTO(struct task_struct *p, unsigned long task_util,
694 int targeted_cpus, int nrg_pack, int nrg_spread),
695
696 TP_ARGS(p, task_util, targeted_cpus, nrg_pack, nrg_spread),
697
698 TP_STRUCT__entry(
699 __array(char, comm, TASK_COMM_LEN )
700 __field(int, pid )
701 __field(unsigned long, task_util )
702 __field(int, targeted_cpus )
703 __field(int, nrg_pack )
704 __field(int, nrg_spread )
705 ),
706
707 TP_fast_assign(
708 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
709 __entry->pid = p->pid;
710 __entry->task_util = task_util;
711 __entry->targeted_cpus = targeted_cpus;
712 __entry->nrg_pack = nrg_pack;
713 __entry->nrg_spread = nrg_spread;
714 ),
715
716 TP_printk("comm=%s pid=%d task_util=%lu targeted_cpus=%d nrg_pack=%d nrg_spread=%d nrg_diff=%d",
717 __entry->comm, __entry->pid, __entry->task_util,
718 __entry->targeted_cpus, __entry->nrg_pack,
719 __entry->nrg_spread, __entry->nrg_pack - __entry->nrg_spread)
720);
721
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800722DECLARE_EVENT_CLASS(sched_task_util,
723
Joonwoo Park4fdf00d2017-02-17 11:42:44 -0800724 TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle),
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800725
Joonwoo Park4fdf00d2017-02-17 11:42:44 -0800726 TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle),
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800727
728 TP_STRUCT__entry(
729 __array(char, comm, TASK_COMM_LEN )
730 __field(int, pid )
731 __field(int, task_cpu )
732 __field(unsigned long, task_util )
733 __field(unsigned long, cpu_util_freq )
734 __field(int, nominated_cpu )
735 __field(int, target_cpu )
736 __field(int, ediff )
Joonwoo Park4fdf00d2017-02-17 11:42:44 -0800737 __field(bool, need_idle )
Syed Rameez Mustafae2ccaa22017-04-05 12:35:25 -0700738 __field(u64, latency )
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800739 ),
740
741 TP_fast_assign(
742 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
743 __entry->pid = p->pid;
744 __entry->task_cpu = task_cpu;
745 __entry->task_util = task_util;
746 __entry->cpu_util_freq = cpu_util_freq(target_cpu, NULL);
747 __entry->nominated_cpu = nominated_cpu;
748 __entry->target_cpu = target_cpu;
Joonwoo Park4fdf00d2017-02-17 11:42:44 -0800749 __entry->ediff = ediff;
750 __entry->need_idle = need_idle;
Joonwoo Park8fc91312017-06-07 15:10:58 -0700751 __entry->latency = p->ravg.mark_start ?
752 sched_ktime_clock() -
753 p->ravg.mark_start : 0;
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800754 ),
755
Syed Rameez Mustafae2ccaa22017-04-05 12:35:25 -0700756 TP_printk("comm=%s pid=%d task_cpu=%d task_util=%lu nominated_cpu=%d target_cpu=%d energy_diff=%d need_idle=%d latency=%llu",
757 __entry->comm, __entry->pid, __entry->task_cpu, __entry->task_util, __entry->nominated_cpu, __entry->target_cpu, __entry->ediff, __entry->need_idle, __entry->latency)
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800758);
759
Syed Rameez Mustafa20acfe72017-01-30 09:35:46 +0530760DEFINE_EVENT(sched_task_util, sched_task_util_bias_to_waker,
761 TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle),
762 TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle)
763);
764
765DEFINE_EVENT(sched_task_util, sched_task_util_colocated,
766 TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle),
767 TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle)
768);
769
Pavankumar Kondetieb486cc2017-06-19 15:28:50 +0530770DEFINE_EVENT(sched_task_util, sched_task_util_boosted,
771 TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle),
772 TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle)
773);
774
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800775DEFINE_EVENT(sched_task_util, sched_task_util_overutilzed,
Joonwoo Park4fdf00d2017-02-17 11:42:44 -0800776 TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle),
777 TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle)
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800778);
779
780DEFINE_EVENT(sched_task_util, sched_task_util_energy_diff,
Joonwoo Park4fdf00d2017-02-17 11:42:44 -0800781 TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle),
782 TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle)
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800783);
784
785DEFINE_EVENT(sched_task_util, sched_task_util_energy_aware,
Joonwoo Park4fdf00d2017-02-17 11:42:44 -0800786 TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle),
787 TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle)
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800788);
Joonwoo Park12084a12017-02-16 16:46:27 -0800789
790DEFINE_EVENT(sched_task_util, sched_task_util_imbalance,
Joonwoo Park4fdf00d2017-02-17 11:42:44 -0800791 TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle),
792 TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle)
Joonwoo Park12084a12017-02-16 16:46:27 -0800793);
Joonwoo Parkcc7d1272017-01-26 14:47:00 -0800794#endif
795
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700796/*
Steven Rostedtea20d922009-04-10 08:54:16 -0400797 * Tracepoint for waking up a task:
Steven Rostedtea20d922009-04-10 08:54:16 -0400798 */
Ingo Molnar091ad362009-11-26 09:04:55 +0100799DECLARE_EVENT_CLASS(sched_wakeup_template,
Steven Rostedtea20d922009-04-10 08:54:16 -0400800
Peter Zijlstrafbd705a2015-06-09 11:13:36 +0200801 TP_PROTO(struct task_struct *p),
Steven Rostedtea20d922009-04-10 08:54:16 -0400802
Peter Zijlstrafbd705a2015-06-09 11:13:36 +0200803 TP_ARGS(__perf_task(p)),
Steven Rostedtea20d922009-04-10 08:54:16 -0400804
805 TP_STRUCT__entry(
806 __array( char, comm, TASK_COMM_LEN )
807 __field( pid_t, pid )
808 __field( int, prio )
809 __field( int, success )
Ingo Molnar434a83c2009-10-15 11:50:39 +0200810 __field( int, target_cpu )
Steven Rostedtea20d922009-04-10 08:54:16 -0400811 ),
812
813 TP_fast_assign(
814 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
815 __entry->pid = p->pid;
816 __entry->prio = p->prio;
Peter Zijlstrafbd705a2015-06-09 11:13:36 +0200817 __entry->success = 1; /* rudiment, kill when possible */
Ingo Molnar434a83c2009-10-15 11:50:39 +0200818 __entry->target_cpu = task_cpu(p);
Steven Rostedtea20d922009-04-10 08:54:16 -0400819 ),
820
Peter Zijlstrafbd705a2015-06-09 11:13:36 +0200821 TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d",
Steven Rostedtea20d922009-04-10 08:54:16 -0400822 __entry->comm, __entry->pid, __entry->prio,
Peter Zijlstrafbd705a2015-06-09 11:13:36 +0200823 __entry->target_cpu)
Steven Rostedtea20d922009-04-10 08:54:16 -0400824);
825
Peter Zijlstrafbd705a2015-06-09 11:13:36 +0200826/*
827 * Tracepoint called when waking a task; this tracepoint is guaranteed to be
828 * called from the waking context.
829 */
830DEFINE_EVENT(sched_wakeup_template, sched_waking,
831 TP_PROTO(struct task_struct *p),
832 TP_ARGS(p));
833
834/*
835 * Tracepoint called when the task is actually woken; p->state == TASK_RUNNNG.
836 * It it not always called from the waking context.
837 */
Steven Rostedt75ec29a2009-11-18 20:48:08 -0500838DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
Peter Zijlstrafbd705a2015-06-09 11:13:36 +0200839 TP_PROTO(struct task_struct *p),
840 TP_ARGS(p));
Steven Rostedt75ec29a2009-11-18 20:48:08 -0500841
Steven Rostedtea20d922009-04-10 08:54:16 -0400842/*
843 * Tracepoint for waking up a new task:
Steven Rostedtea20d922009-04-10 08:54:16 -0400844 */
Steven Rostedt75ec29a2009-11-18 20:48:08 -0500845DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
Peter Zijlstrafbd705a2015-06-09 11:13:36 +0200846 TP_PROTO(struct task_struct *p),
847 TP_ARGS(p));
Steven Rostedtea20d922009-04-10 08:54:16 -0400848
Peter Zijlstra02f72692010-05-31 18:13:25 +0200849#ifdef CREATE_TRACE_POINTS
Peter Zijlstrac73464b2015-09-28 18:06:56 +0200850static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p)
Peter Zijlstra02f72692010-05-31 18:13:25 +0200851{
Oleg Nesterov8f9fbf02014-10-07 21:51:08 +0200852#ifdef CONFIG_SCHED_DEBUG
853 BUG_ON(p != current);
854#endif /* CONFIG_SCHED_DEBUG */
Peter Zijlstra02f72692010-05-31 18:13:25 +0200855
Peter Zijlstrac73464b2015-09-28 18:06:56 +0200856 /*
857 * Preemption ignores task state, therefore preempted tasks are always
858 * RUNNING (we will not have dequeued if state != RUNNING).
859 */
860 return preempt ? TASK_RUNNING | TASK_STATE_MAX : p->state;
Peter Zijlstra02f72692010-05-31 18:13:25 +0200861}
Oleg Nesterov8f9fbf02014-10-07 21:51:08 +0200862#endif /* CREATE_TRACE_POINTS */
Peter Zijlstra02f72692010-05-31 18:13:25 +0200863
Steven Rostedtea20d922009-04-10 08:54:16 -0400864/*
865 * Tracepoint for task switches, performed by the scheduler:
Steven Rostedtea20d922009-04-10 08:54:16 -0400866 */
867TRACE_EVENT(sched_switch,
868
Peter Zijlstrac73464b2015-09-28 18:06:56 +0200869 TP_PROTO(bool preempt,
870 struct task_struct *prev,
Steven Rostedtea20d922009-04-10 08:54:16 -0400871 struct task_struct *next),
872
Peter Zijlstrac73464b2015-09-28 18:06:56 +0200873 TP_ARGS(preempt, prev, next),
Steven Rostedtea20d922009-04-10 08:54:16 -0400874
875 TP_STRUCT__entry(
876 __array( char, prev_comm, TASK_COMM_LEN )
877 __field( pid_t, prev_pid )
878 __field( int, prev_prio )
Steven Rostedt937cdb92009-05-15 10:51:13 -0400879 __field( long, prev_state )
Steven Rostedtea20d922009-04-10 08:54:16 -0400880 __array( char, next_comm, TASK_COMM_LEN )
881 __field( pid_t, next_pid )
882 __field( int, next_prio )
883 ),
884
885 TP_fast_assign(
886 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
887 __entry->prev_pid = prev->pid;
888 __entry->prev_prio = prev->prio;
Peter Zijlstrac73464b2015-09-28 18:06:56 +0200889 __entry->prev_state = __trace_sched_switch_state(preempt, prev);
Steven Rostedtea20d922009-04-10 08:54:16 -0400890 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
891 __entry->next_pid = next->pid;
892 __entry->next_prio = next->prio;
893 ),
894
Peter Zijlstra557ab422011-09-16 11:16:43 +0200895 TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d",
Steven Rostedtea20d922009-04-10 08:54:16 -0400896 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
Peter Zijlstra557ab422011-09-16 11:16:43 +0200897 __entry->prev_state & (TASK_STATE_MAX-1) ?
898 __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|",
Steven Rostedt937cdb92009-05-15 10:51:13 -0400899 { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
900 { 16, "Z" }, { 32, "X" }, { 64, "x" },
Peter Zijlstra80ed87c2015-05-08 14:23:45 +0200901 { 128, "K" }, { 256, "W" }, { 512, "P" },
902 { 1024, "N" }) : "R",
Peter Zijlstra557ab422011-09-16 11:16:43 +0200903 __entry->prev_state & TASK_STATE_MAX ? "+" : "",
Steven Rostedtea20d922009-04-10 08:54:16 -0400904 __entry->next_comm, __entry->next_pid, __entry->next_prio)
905);
906
907/*
908 * Tracepoint for a task being migrated:
909 */
910TRACE_EVENT(sched_migrate_task,
911
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700912 TP_PROTO(struct task_struct *p, int dest_cpu, unsigned int load),
Steven Rostedtea20d922009-04-10 08:54:16 -0400913
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700914 TP_ARGS(p, dest_cpu, load),
Steven Rostedtea20d922009-04-10 08:54:16 -0400915
916 TP_STRUCT__entry(
917 __array( char, comm, TASK_COMM_LEN )
918 __field( pid_t, pid )
919 __field( int, prio )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700920 __field(unsigned int, load )
Steven Rostedtea20d922009-04-10 08:54:16 -0400921 __field( int, orig_cpu )
922 __field( int, dest_cpu )
923 ),
924
925 TP_fast_assign(
926 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
927 __entry->pid = p->pid;
928 __entry->prio = p->prio;
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700929 __entry->load = load;
Mathieu Desnoyersde1d7282009-05-05 16:49:59 +0800930 __entry->orig_cpu = task_cpu(p);
Steven Rostedtea20d922009-04-10 08:54:16 -0400931 __entry->dest_cpu = dest_cpu;
932 ),
933
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700934 TP_printk("comm=%s pid=%d prio=%d load=%d orig_cpu=%d dest_cpu=%d",
935 __entry->comm, __entry->pid, __entry->prio, __entry->load,
Steven Rostedtea20d922009-04-10 08:54:16 -0400936 __entry->orig_cpu, __entry->dest_cpu)
937);
938
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -0700939/*
940 * Tracepoint for a CPU going offline/online:
941 */
942TRACE_EVENT(sched_cpu_hotplug,
943
944 TP_PROTO(int affected_cpu, int error, int status),
945
946 TP_ARGS(affected_cpu, error, status),
947
948 TP_STRUCT__entry(
949 __field( int, affected_cpu )
950 __field( int, error )
951 __field( int, status )
952 ),
953
954 TP_fast_assign(
955 __entry->affected_cpu = affected_cpu;
956 __entry->error = error;
957 __entry->status = status;
958 ),
959
960 TP_printk("cpu %d %s error=%d", __entry->affected_cpu,
961 __entry->status ? "online" : "offline", __entry->error)
962);
963
964/*
965 * Tracepoint for load balancing:
966 */
967#if NR_CPUS > 32
968#error "Unsupported NR_CPUS for lb tracepoint."
969#endif
970TRACE_EVENT(sched_load_balance,
971
972 TP_PROTO(int cpu, enum cpu_idle_type idle, int balance,
973 unsigned long group_mask, int busiest_nr_running,
974 unsigned long imbalance, unsigned int env_flags, int ld_moved,
975 unsigned int balance_interval),
976
977 TP_ARGS(cpu, idle, balance, group_mask, busiest_nr_running,
978 imbalance, env_flags, ld_moved, balance_interval),
979
980 TP_STRUCT__entry(
981 __field( int, cpu)
982 __field( enum cpu_idle_type, idle)
983 __field( int, balance)
984 __field( unsigned long, group_mask)
985 __field( int, busiest_nr_running)
986 __field( unsigned long, imbalance)
987 __field( unsigned int, env_flags)
988 __field( int, ld_moved)
989 __field( unsigned int, balance_interval)
990 ),
991
992 TP_fast_assign(
993 __entry->cpu = cpu;
994 __entry->idle = idle;
995 __entry->balance = balance;
996 __entry->group_mask = group_mask;
997 __entry->busiest_nr_running = busiest_nr_running;
998 __entry->imbalance = imbalance;
999 __entry->env_flags = env_flags;
1000 __entry->ld_moved = ld_moved;
1001 __entry->balance_interval = balance_interval;
1002 ),
1003
1004 TP_printk("cpu=%d state=%s balance=%d group=%#lx busy_nr=%d imbalance=%ld flags=%#x ld_moved=%d bal_int=%d",
1005 __entry->cpu,
1006 __entry->idle == CPU_IDLE ? "idle" :
1007 (__entry->idle == CPU_NEWLY_IDLE ? "newly_idle" : "busy"),
1008 __entry->balance,
1009 __entry->group_mask, __entry->busiest_nr_running,
1010 __entry->imbalance, __entry->env_flags, __entry->ld_moved,
1011 __entry->balance_interval)
1012);
1013
Ingo Molnar091ad362009-11-26 09:04:55 +01001014DECLARE_EVENT_CLASS(sched_process_template,
Steven Rostedtea20d922009-04-10 08:54:16 -04001015
1016 TP_PROTO(struct task_struct *p),
1017
1018 TP_ARGS(p),
1019
1020 TP_STRUCT__entry(
1021 __array( char, comm, TASK_COMM_LEN )
1022 __field( pid_t, pid )
1023 __field( int, prio )
1024 ),
1025
1026 TP_fast_assign(
1027 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
1028 __entry->pid = p->pid;
1029 __entry->prio = p->prio;
1030 ),
1031
Ingo Molnar434a83c2009-10-15 11:50:39 +02001032 TP_printk("comm=%s pid=%d prio=%d",
Steven Rostedtea20d922009-04-10 08:54:16 -04001033 __entry->comm, __entry->pid, __entry->prio)
1034);
1035
1036/*
Steven Rostedt75ec29a2009-11-18 20:48:08 -05001037 * Tracepoint for freeing a task:
1038 */
1039DEFINE_EVENT(sched_process_template, sched_process_free,
1040 TP_PROTO(struct task_struct *p),
1041 TP_ARGS(p));
Riley Andrews9de15b42015-10-02 00:39:53 -07001042
Steven Rostedt75ec29a2009-11-18 20:48:08 -05001043
1044/*
Steven Rostedtea20d922009-04-10 08:54:16 -04001045 * Tracepoint for a task exiting:
1046 */
Steven Rostedt75ec29a2009-11-18 20:48:08 -05001047DEFINE_EVENT(sched_process_template, sched_process_exit,
1048 TP_PROTO(struct task_struct *p),
1049 TP_ARGS(p));
Steven Rostedtea20d922009-04-10 08:54:16 -04001050
1051/*
Li Zefan210f7662010-05-24 16:23:35 +08001052 * Tracepoint for waiting on task to unschedule:
1053 */
1054DEFINE_EVENT(sched_process_template, sched_wait_task,
1055 TP_PROTO(struct task_struct *p),
1056 TP_ARGS(p));
1057
1058/*
Steven Rostedtea20d922009-04-10 08:54:16 -04001059 * Tracepoint for a waiting task:
1060 */
1061TRACE_EVENT(sched_process_wait,
1062
1063 TP_PROTO(struct pid *pid),
1064
1065 TP_ARGS(pid),
1066
1067 TP_STRUCT__entry(
1068 __array( char, comm, TASK_COMM_LEN )
1069 __field( pid_t, pid )
1070 __field( int, prio )
1071 ),
1072
1073 TP_fast_assign(
1074 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
1075 __entry->pid = pid_nr(pid);
1076 __entry->prio = current->prio;
1077 ),
1078
Ingo Molnar434a83c2009-10-15 11:50:39 +02001079 TP_printk("comm=%s pid=%d prio=%d",
Steven Rostedtea20d922009-04-10 08:54:16 -04001080 __entry->comm, __entry->pid, __entry->prio)
1081);
1082
1083/*
1084 * Tracepoint for do_fork:
1085 */
1086TRACE_EVENT(sched_process_fork,
1087
1088 TP_PROTO(struct task_struct *parent, struct task_struct *child),
1089
1090 TP_ARGS(parent, child),
1091
1092 TP_STRUCT__entry(
1093 __array( char, parent_comm, TASK_COMM_LEN )
1094 __field( pid_t, parent_pid )
1095 __array( char, child_comm, TASK_COMM_LEN )
1096 __field( pid_t, child_pid )
1097 ),
1098
1099 TP_fast_assign(
1100 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
1101 __entry->parent_pid = parent->pid;
1102 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
1103 __entry->child_pid = child->pid;
1104 ),
1105
Ingo Molnar434a83c2009-10-15 11:50:39 +02001106 TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d",
Steven Rostedtea20d922009-04-10 08:54:16 -04001107 __entry->parent_comm, __entry->parent_pid,
1108 __entry->child_comm, __entry->child_pid)
1109);
1110
1111/*
David Smith4ff16c22012-02-07 10:11:05 -06001112 * Tracepoint for exec:
1113 */
1114TRACE_EVENT(sched_process_exec,
1115
1116 TP_PROTO(struct task_struct *p, pid_t old_pid,
1117 struct linux_binprm *bprm),
1118
1119 TP_ARGS(p, old_pid, bprm),
1120
1121 TP_STRUCT__entry(
1122 __string( filename, bprm->filename )
1123 __field( pid_t, pid )
1124 __field( pid_t, old_pid )
1125 ),
1126
1127 TP_fast_assign(
1128 __assign_str(filename, bprm->filename);
1129 __entry->pid = p->pid;
Oleg Nesterov63081912012-03-30 18:26:36 +02001130 __entry->old_pid = old_pid;
David Smith4ff16c22012-02-07 10:11:05 -06001131 ),
1132
1133 TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
1134 __entry->pid, __entry->old_pid)
1135);
1136
1137/*
Peter Zijlstra768d0c22009-07-23 20:13:26 +02001138 * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
1139 * adding sched_stat support to SCHED_FIFO/RR would be welcome.
1140 */
Ingo Molnar091ad362009-11-26 09:04:55 +01001141DECLARE_EVENT_CLASS(sched_stat_template,
Peter Zijlstra768d0c22009-07-23 20:13:26 +02001142
1143 TP_PROTO(struct task_struct *tsk, u64 delay),
1144
Oleg Nesterov12473962013-08-06 18:08:44 +02001145 TP_ARGS(__perf_task(tsk), __perf_count(delay)),
Peter Zijlstra768d0c22009-07-23 20:13:26 +02001146
1147 TP_STRUCT__entry(
1148 __array( char, comm, TASK_COMM_LEN )
1149 __field( pid_t, pid )
1150 __field( u64, delay )
1151 ),
1152
1153 TP_fast_assign(
1154 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
1155 __entry->pid = tsk->pid;
1156 __entry->delay = delay;
Peter Zijlstra768d0c22009-07-23 20:13:26 +02001157 ),
1158
Ingo Molnar434a83c2009-10-15 11:50:39 +02001159 TP_printk("comm=%s pid=%d delay=%Lu [ns]",
Peter Zijlstra768d0c22009-07-23 20:13:26 +02001160 __entry->comm, __entry->pid,
1161 (unsigned long long)__entry->delay)
1162);
1163
Steven Rostedt75ec29a2009-11-18 20:48:08 -05001164
1165/*
1166 * Tracepoint for accounting wait time (time the task is runnable
1167 * but not actually running due to scheduler contention).
1168 */
1169DEFINE_EVENT(sched_stat_template, sched_stat_wait,
1170 TP_PROTO(struct task_struct *tsk, u64 delay),
1171 TP_ARGS(tsk, delay));
1172
1173/*
1174 * Tracepoint for accounting sleep time (time the task is not runnable,
1175 * including iowait, see below).
1176 */
Li Zefan470dda742009-11-26 15:08:01 +08001177DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
1178 TP_PROTO(struct task_struct *tsk, u64 delay),
1179 TP_ARGS(tsk, delay));
Steven Rostedt75ec29a2009-11-18 20:48:08 -05001180
1181/*
1182 * Tracepoint for accounting iowait time (time the task is not runnable
1183 * due to waiting on IO to complete).
1184 */
Li Zefan470dda742009-11-26 15:08:01 +08001185DEFINE_EVENT(sched_stat_template, sched_stat_iowait,
1186 TP_PROTO(struct task_struct *tsk, u64 delay),
1187 TP_ARGS(tsk, delay));
Steven Rostedt75ec29a2009-11-18 20:48:08 -05001188
Peter Zijlstra768d0c22009-07-23 20:13:26 +02001189/*
Andrew Vaginb781a602011-11-28 12:03:35 +03001190 * Tracepoint for accounting blocked time (time the task is in uninterruptible).
1191 */
1192DEFINE_EVENT(sched_stat_template, sched_stat_blocked,
1193 TP_PROTO(struct task_struct *tsk, u64 delay),
1194 TP_ARGS(tsk, delay));
1195
1196/*
Riley Andrews9de15b42015-10-02 00:39:53 -07001197 * Tracepoint for recording the cause of uninterruptible sleep.
1198 */
1199TRACE_EVENT(sched_blocked_reason,
1200
1201 TP_PROTO(struct task_struct *tsk),
1202
1203 TP_ARGS(tsk),
1204
1205 TP_STRUCT__entry(
1206 __field( pid_t, pid )
1207 __field( void*, caller )
1208 __field( bool, io_wait )
1209 ),
1210
1211 TP_fast_assign(
1212 __entry->pid = tsk->pid;
1213 __entry->caller = (void*)get_wchan(tsk);
1214 __entry->io_wait = tsk->in_iowait;
1215 ),
1216
1217 TP_printk("pid=%d iowait=%d caller=%pS", __entry->pid, __entry->io_wait, __entry->caller)
1218);
1219
1220/*
Ingo Molnarf977bb42009-09-13 18:15:54 +02001221 * Tracepoint for accounting runtime (time the task is executing
1222 * on a CPU).
1223 */
Oleg Nesterov36009d072013-08-06 18:08:41 +02001224DECLARE_EVENT_CLASS(sched_stat_runtime,
Ingo Molnarf977bb42009-09-13 18:15:54 +02001225
1226 TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
1227
Oleg Nesterov12473962013-08-06 18:08:44 +02001228 TP_ARGS(tsk, __perf_count(runtime), vruntime),
Ingo Molnarf977bb42009-09-13 18:15:54 +02001229
1230 TP_STRUCT__entry(
1231 __array( char, comm, TASK_COMM_LEN )
1232 __field( pid_t, pid )
1233 __field( u64, runtime )
1234 __field( u64, vruntime )
1235 ),
1236
1237 TP_fast_assign(
1238 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
1239 __entry->pid = tsk->pid;
1240 __entry->runtime = runtime;
1241 __entry->vruntime = vruntime;
Ingo Molnarf977bb42009-09-13 18:15:54 +02001242 ),
1243
Ingo Molnar434a83c2009-10-15 11:50:39 +02001244 TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]",
Ingo Molnarf977bb42009-09-13 18:15:54 +02001245 __entry->comm, __entry->pid,
1246 (unsigned long long)__entry->runtime,
1247 (unsigned long long)__entry->vruntime)
1248);
1249
Oleg Nesterov36009d072013-08-06 18:08:41 +02001250DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime,
1251 TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
1252 TP_ARGS(tsk, runtime, vruntime));
1253
Steven Rostedta8027072010-09-20 15:13:34 -04001254/*
1255 * Tracepoint for showing priority inheritance modifying a tasks
1256 * priority.
1257 */
1258TRACE_EVENT(sched_pi_setprio,
1259
1260 TP_PROTO(struct task_struct *tsk, int newprio),
1261
1262 TP_ARGS(tsk, newprio),
1263
1264 TP_STRUCT__entry(
1265 __array( char, comm, TASK_COMM_LEN )
1266 __field( pid_t, pid )
1267 __field( int, oldprio )
1268 __field( int, newprio )
1269 ),
1270
1271 TP_fast_assign(
1272 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
1273 __entry->pid = tsk->pid;
1274 __entry->oldprio = tsk->prio;
1275 __entry->newprio = newprio;
1276 ),
1277
1278 TP_printk("comm=%s pid=%d oldprio=%d newprio=%d",
1279 __entry->comm, __entry->pid,
1280 __entry->oldprio, __entry->newprio)
1281);
1282
Oleg Nesterov6a716c92013-10-19 18:18:28 +02001283#ifdef CONFIG_DETECT_HUNG_TASK
1284TRACE_EVENT(sched_process_hang,
1285 TP_PROTO(struct task_struct *tsk),
1286 TP_ARGS(tsk),
1287
1288 TP_STRUCT__entry(
1289 __array( char, comm, TASK_COMM_LEN )
1290 __field( pid_t, pid )
1291 ),
1292
1293 TP_fast_assign(
1294 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
1295 __entry->pid = tsk->pid;
1296 ),
1297
1298 TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid)
1299);
1300#endif /* CONFIG_DETECT_HUNG_TASK */
1301
Mel Gorman286549d2014-01-21 15:51:03 -08001302DECLARE_EVENT_CLASS(sched_move_task_template,
1303
1304 TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu),
1305
1306 TP_ARGS(tsk, src_cpu, dst_cpu),
1307
1308 TP_STRUCT__entry(
1309 __field( pid_t, pid )
1310 __field( pid_t, tgid )
1311 __field( pid_t, ngid )
1312 __field( int, src_cpu )
1313 __field( int, src_nid )
1314 __field( int, dst_cpu )
1315 __field( int, dst_nid )
1316 ),
1317
1318 TP_fast_assign(
1319 __entry->pid = task_pid_nr(tsk);
1320 __entry->tgid = task_tgid_nr(tsk);
1321 __entry->ngid = task_numa_group_id(tsk);
1322 __entry->src_cpu = src_cpu;
1323 __entry->src_nid = cpu_to_node(src_cpu);
1324 __entry->dst_cpu = dst_cpu;
1325 __entry->dst_nid = cpu_to_node(dst_cpu);
1326 ),
1327
1328 TP_printk("pid=%d tgid=%d ngid=%d src_cpu=%d src_nid=%d dst_cpu=%d dst_nid=%d",
1329 __entry->pid, __entry->tgid, __entry->ngid,
1330 __entry->src_cpu, __entry->src_nid,
1331 __entry->dst_cpu, __entry->dst_nid)
1332);
1333
1334/*
1335 * Tracks migration of tasks from one runqueue to another. Can be used to
1336 * detect if automatic NUMA balancing is bouncing between nodes
1337 */
1338DEFINE_EVENT(sched_move_task_template, sched_move_numa,
1339 TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu),
1340
1341 TP_ARGS(tsk, src_cpu, dst_cpu)
1342);
1343
1344DEFINE_EVENT(sched_move_task_template, sched_stick_numa,
1345 TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu),
1346
1347 TP_ARGS(tsk, src_cpu, dst_cpu)
1348);
1349
1350TRACE_EVENT(sched_swap_numa,
1351
1352 TP_PROTO(struct task_struct *src_tsk, int src_cpu,
1353 struct task_struct *dst_tsk, int dst_cpu),
1354
1355 TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu),
1356
1357 TP_STRUCT__entry(
1358 __field( pid_t, src_pid )
1359 __field( pid_t, src_tgid )
1360 __field( pid_t, src_ngid )
1361 __field( int, src_cpu )
1362 __field( int, src_nid )
1363 __field( pid_t, dst_pid )
1364 __field( pid_t, dst_tgid )
1365 __field( pid_t, dst_ngid )
1366 __field( int, dst_cpu )
1367 __field( int, dst_nid )
1368 ),
1369
1370 TP_fast_assign(
1371 __entry->src_pid = task_pid_nr(src_tsk);
1372 __entry->src_tgid = task_tgid_nr(src_tsk);
1373 __entry->src_ngid = task_numa_group_id(src_tsk);
1374 __entry->src_cpu = src_cpu;
1375 __entry->src_nid = cpu_to_node(src_cpu);
1376 __entry->dst_pid = task_pid_nr(dst_tsk);
1377 __entry->dst_tgid = task_tgid_nr(dst_tsk);
1378 __entry->dst_ngid = task_numa_group_id(dst_tsk);
1379 __entry->dst_cpu = dst_cpu;
1380 __entry->dst_nid = cpu_to_node(dst_cpu);
1381 ),
1382
1383 TP_printk("src_pid=%d src_tgid=%d src_ngid=%d src_cpu=%d src_nid=%d dst_pid=%d dst_tgid=%d dst_ngid=%d dst_cpu=%d dst_nid=%d",
1384 __entry->src_pid, __entry->src_tgid, __entry->src_ngid,
1385 __entry->src_cpu, __entry->src_nid,
1386 __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid,
1387 __entry->dst_cpu, __entry->dst_nid)
1388);
Andy Lutomirskidfc68f22014-06-04 10:31:15 -07001389
1390/*
1391 * Tracepoint for waking a polling cpu without an IPI.
1392 */
1393TRACE_EVENT(sched_wake_idle_without_ipi,
1394
1395 TP_PROTO(int cpu),
1396
1397 TP_ARGS(cpu),
1398
1399 TP_STRUCT__entry(
1400 __field( int, cpu )
1401 ),
1402
1403 TP_fast_assign(
1404 __entry->cpu = cpu;
1405 ),
1406
1407 TP_printk("cpu=%d", __entry->cpu)
1408);
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -07001409
Juri Lelli0a942002015-11-09 12:06:24 +00001410TRACE_EVENT(sched_contrib_scale_f,
Juri Lelli0a942002015-11-09 12:06:24 +00001411 TP_PROTO(int cpu, unsigned long freq_scale_factor,
1412 unsigned long cpu_scale_factor),
Juri Lelli0a942002015-11-09 12:06:24 +00001413 TP_ARGS(cpu, freq_scale_factor, cpu_scale_factor),
Juri Lelli0a942002015-11-09 12:06:24 +00001414 TP_STRUCT__entry(
1415 __field(int, cpu)
1416 __field(unsigned long, freq_scale_factor)
1417 __field(unsigned long, cpu_scale_factor)
1418 ),
Juri Lelli0a942002015-11-09 12:06:24 +00001419 TP_fast_assign(
1420 __entry->cpu = cpu;
1421 __entry->freq_scale_factor = freq_scale_factor;
1422 __entry->cpu_scale_factor = cpu_scale_factor;
1423 ),
Juri Lelli0a942002015-11-09 12:06:24 +00001424 TP_printk("cpu=%d freq_scale_factor=%lu cpu_scale_factor=%lu",
1425 __entry->cpu, __entry->freq_scale_factor,
1426 __entry->cpu_scale_factor)
1427);
Juri Lellia4b0c3a2015-11-09 12:07:27 +00001428
Jeevan Shriram49f575e2017-03-02 16:52:44 -08001429#ifdef CONFIG_SMP
Juri Lellia4b0c3a2015-11-09 12:07:27 +00001430/*
1431 * Tracepoint for accounting sched averages for tasks.
1432 */
1433TRACE_EVENT(sched_load_avg_task,
Juri Lellia4b0c3a2015-11-09 12:07:27 +00001434 TP_PROTO(struct task_struct *tsk, struct sched_avg *avg),
Juri Lellia4b0c3a2015-11-09 12:07:27 +00001435 TP_ARGS(tsk, avg),
Juri Lellia4b0c3a2015-11-09 12:07:27 +00001436 TP_STRUCT__entry(
1437 __array( char, comm, TASK_COMM_LEN )
1438 __field( pid_t, pid )
1439 __field( int, cpu )
1440 __field( unsigned long, load_avg )
1441 __field( unsigned long, util_avg )
1442 __field( u64, load_sum )
1443 __field( u32, util_sum )
1444 __field( u32, period_contrib )
1445 ),
Juri Lellia4b0c3a2015-11-09 12:07:27 +00001446 TP_fast_assign(
1447 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
1448 __entry->pid = tsk->pid;
1449 __entry->cpu = task_cpu(tsk);
1450 __entry->load_avg = avg->load_avg;
1451 __entry->util_avg = avg->util_avg;
1452 __entry->load_sum = avg->load_sum;
1453 __entry->util_sum = avg->util_sum;
1454 __entry->period_contrib = avg->period_contrib;
1455 ),
Juri Lellia4b0c3a2015-11-09 12:07:27 +00001456 TP_printk("comm=%s pid=%d cpu=%d load_avg=%lu util_avg=%lu load_sum=%llu"
1457 " util_sum=%u period_contrib=%u",
1458 __entry->comm,
1459 __entry->pid,
1460 __entry->cpu,
1461 __entry->load_avg,
1462 __entry->util_avg,
1463 (u64)__entry->load_sum,
1464 (u32)__entry->util_sum,
1465 (u32)__entry->period_contrib)
1466);
Juri Lelli79478802015-11-09 12:07:48 +00001467/*
1468 * Tracepoint for accounting sched averages for cpus.
1469 */
1470TRACE_EVENT(sched_load_avg_cpu,
Juri Lelli79478802015-11-09 12:07:48 +00001471 TP_PROTO(int cpu, struct cfs_rq *cfs_rq),
Juri Lelli79478802015-11-09 12:07:48 +00001472 TP_ARGS(cpu, cfs_rq),
Juri Lelli79478802015-11-09 12:07:48 +00001473 TP_STRUCT__entry(
1474 __field( int, cpu )
1475 __field( unsigned long, load_avg )
1476 __field( unsigned long, util_avg )
1477 ),
Juri Lelli79478802015-11-09 12:07:48 +00001478 TP_fast_assign(
1479 __entry->cpu = cpu;
1480 __entry->load_avg = cfs_rq->avg.load_avg;
1481 __entry->util_avg = cfs_rq->avg.util_avg;
1482 ),
Juri Lelli79478802015-11-09 12:07:48 +00001483 TP_printk("cpu=%d load_avg=%lu util_avg=%lu",
1484 __entry->cpu, __entry->load_avg, __entry->util_avg)
1485);
Patrick Bellasi050dcb82015-06-22 13:49:07 +01001486/*
1487 * Tracepoint for sched_tune_config settings
1488 */
1489TRACE_EVENT(sched_tune_config,
Patrick Bellasi050dcb82015-06-22 13:49:07 +01001490 TP_PROTO(int boost),
Patrick Bellasi050dcb82015-06-22 13:49:07 +01001491 TP_ARGS(boost),
Patrick Bellasi050dcb82015-06-22 13:49:07 +01001492 TP_STRUCT__entry(
1493 __field( int, boost )
1494 ),
Patrick Bellasi050dcb82015-06-22 13:49:07 +01001495 TP_fast_assign(
1496 __entry->boost = boost;
1497 ),
Patrick Bellasi050dcb82015-06-22 13:49:07 +01001498 TP_printk("boost=%d ", __entry->boost)
1499);
Patrick Bellasicccead12015-06-22 13:51:07 +01001500/*
1501 * Tracepoint for accounting CPU boosted utilization
1502 */
1503TRACE_EVENT(sched_boost_cpu,
Srinath Sridharane71c4252016-07-28 17:28:55 +01001504 TP_PROTO(int cpu, unsigned long util, long margin),
Patrick Bellasicccead12015-06-22 13:51:07 +01001505 TP_ARGS(cpu, util, margin),
Patrick Bellasicccead12015-06-22 13:51:07 +01001506 TP_STRUCT__entry(
1507 __field( int, cpu )
1508 __field( unsigned long, util )
Srinath Sridharane71c4252016-07-28 17:28:55 +01001509 __field(long, margin )
Patrick Bellasicccead12015-06-22 13:51:07 +01001510 ),
Patrick Bellasicccead12015-06-22 13:51:07 +01001511 TP_fast_assign(
1512 __entry->cpu = cpu;
1513 __entry->util = util;
1514 __entry->margin = margin;
1515 ),
Srinath Sridharane71c4252016-07-28 17:28:55 +01001516 TP_printk("cpu=%d util=%lu margin=%ld",
Patrick Bellasicccead12015-06-22 13:51:07 +01001517 __entry->cpu,
1518 __entry->util,
1519 __entry->margin)
1520);
Patrick Bellasi953b1042015-06-24 15:36:08 +01001521/*
1522 * Tracepoint for schedtune_tasks_update
1523 */
1524TRACE_EVENT(sched_tune_tasks_update,
Patrick Bellasi953b1042015-06-24 15:36:08 +01001525 TP_PROTO(struct task_struct *tsk, int cpu, int tasks, int idx,
Srinath Sridharane71c4252016-07-28 17:28:55 +01001526 int boost, int max_boost),
Patrick Bellasi953b1042015-06-24 15:36:08 +01001527 TP_ARGS(tsk, cpu, tasks, idx, boost, max_boost),
Patrick Bellasi953b1042015-06-24 15:36:08 +01001528 TP_STRUCT__entry(
1529 __array( char, comm, TASK_COMM_LEN )
1530 __field( pid_t, pid )
1531 __field( int, cpu )
1532 __field( int, tasks )
1533 __field( int, idx )
Srinath Sridharane71c4252016-07-28 17:28:55 +01001534 __field( int, boost )
1535 __field( int, max_boost )
Patrick Bellasi953b1042015-06-24 15:36:08 +01001536 ),
Patrick Bellasi953b1042015-06-24 15:36:08 +01001537 TP_fast_assign(
1538 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
1539 __entry->pid = tsk->pid;
1540 __entry->cpu = cpu;
1541 __entry->tasks = tasks;
1542 __entry->idx = idx;
1543 __entry->boost = boost;
1544 __entry->max_boost = max_boost;
1545 ),
Patrick Bellasi953b1042015-06-24 15:36:08 +01001546 TP_printk("pid=%d comm=%s "
Srinath Sridharane71c4252016-07-28 17:28:55 +01001547 "cpu=%d tasks=%d idx=%d boost=%d max_boost=%d",
Patrick Bellasi953b1042015-06-24 15:36:08 +01001548 __entry->pid, __entry->comm,
1549 __entry->cpu, __entry->tasks, __entry->idx,
1550 __entry->boost, __entry->max_boost)
1551);
Patrick Bellasi953b1042015-06-24 15:36:08 +01001552/*
1553 * Tracepoint for schedtune_boostgroup_update
1554 */
1555TRACE_EVENT(sched_tune_boostgroup_update,
Patrick Bellasi953b1042015-06-24 15:36:08 +01001556 TP_PROTO(int cpu, int variation, int max_boost),
Patrick Bellasi953b1042015-06-24 15:36:08 +01001557 TP_ARGS(cpu, variation, max_boost),
Patrick Bellasi953b1042015-06-24 15:36:08 +01001558 TP_STRUCT__entry(
1559 __field( int, cpu )
1560 __field( int, variation )
1561 __field( int, max_boost )
1562 ),
Patrick Bellasi953b1042015-06-24 15:36:08 +01001563 TP_fast_assign(
1564 __entry->cpu = cpu;
1565 __entry->variation = variation;
1566 __entry->max_boost = max_boost;
1567 ),
Patrick Bellasi953b1042015-06-24 15:36:08 +01001568 TP_printk("cpu=%d variation=%d max_boost=%d",
1569 __entry->cpu, __entry->variation, __entry->max_boost)
1570);
Patrick Bellasiecccdb72016-01-14 18:43:37 +00001571/*
1572 * Tracepoint for accounting task boosted utilization
1573 */
1574TRACE_EVENT(sched_boost_task,
Srinath Sridharane71c4252016-07-28 17:28:55 +01001575 TP_PROTO(struct task_struct *tsk, unsigned long util, long margin),
Patrick Bellasiecccdb72016-01-14 18:43:37 +00001576 TP_ARGS(tsk, util, margin),
Patrick Bellasiecccdb72016-01-14 18:43:37 +00001577 TP_STRUCT__entry(
1578 __array( char, comm, TASK_COMM_LEN )
1579 __field( pid_t, pid )
1580 __field( unsigned long, util )
Srinath Sridharane71c4252016-07-28 17:28:55 +01001581 __field( long, margin )
Patrick Bellasiecccdb72016-01-14 18:43:37 +00001582 ),
Patrick Bellasiecccdb72016-01-14 18:43:37 +00001583 TP_fast_assign(
1584 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
1585 __entry->pid = tsk->pid;
1586 __entry->util = util;
1587 __entry->margin = margin;
1588 ),
Srinath Sridharane71c4252016-07-28 17:28:55 +01001589 TP_printk("comm=%s pid=%d util=%lu margin=%ld",
Patrick Bellasiecccdb72016-01-14 18:43:37 +00001590 __entry->comm, __entry->pid,
1591 __entry->util,
1592 __entry->margin)
1593);
Patrick Bellasi110441b2016-01-14 18:47:21 +00001594/*
1595 * Tracepoint for accounting sched group energy
1596 */
1597TRACE_EVENT(sched_energy_diff,
Patrick Bellasi110441b2016-01-14 18:47:21 +00001598 TP_PROTO(struct task_struct *tsk, int scpu, int dcpu, int udelta,
1599 int nrgb, int nrga, int nrgd, int capb, int capa, int capd,
1600 int nrgn, int nrgp),
Patrick Bellasi110441b2016-01-14 18:47:21 +00001601 TP_ARGS(tsk, scpu, dcpu, udelta,
1602 nrgb, nrga, nrgd, capb, capa, capd,
1603 nrgn, nrgp),
Patrick Bellasi110441b2016-01-14 18:47:21 +00001604 TP_STRUCT__entry(
1605 __array( char, comm, TASK_COMM_LEN )
1606 __field( pid_t, pid )
1607 __field( int, scpu )
1608 __field( int, dcpu )
1609 __field( int, udelta )
1610 __field( int, nrgb )
1611 __field( int, nrga )
1612 __field( int, nrgd )
1613 __field( int, capb )
1614 __field( int, capa )
1615 __field( int, capd )
1616 __field( int, nrgn )
1617 __field( int, nrgp )
1618 ),
Patrick Bellasi110441b2016-01-14 18:47:21 +00001619 TP_fast_assign(
1620 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
1621 __entry->pid = tsk->pid;
1622 __entry->scpu = scpu;
1623 __entry->dcpu = dcpu;
1624 __entry->udelta = udelta;
1625 __entry->nrgb = nrgb;
1626 __entry->nrga = nrga;
1627 __entry->nrgd = nrgd;
1628 __entry->capb = capb;
1629 __entry->capa = capa;
1630 __entry->capd = capd;
1631 __entry->nrgn = nrgn;
1632 __entry->nrgp = nrgp;
1633 ),
Patrick Bellasi110441b2016-01-14 18:47:21 +00001634 TP_printk("pid=%d comm=%s "
1635 "src_cpu=%d dst_cpu=%d usage_delta=%d "
1636 "nrg_before=%d nrg_after=%d nrg_diff=%d "
1637 "cap_before=%d cap_after=%d cap_delta=%d "
1638 "nrg_delta=%d nrg_payoff=%d",
1639 __entry->pid, __entry->comm,
1640 __entry->scpu, __entry->dcpu, __entry->udelta,
1641 __entry->nrgb, __entry->nrga, __entry->nrgd,
1642 __entry->capb, __entry->capa, __entry->capd,
1643 __entry->nrgn, __entry->nrgp)
1644);
Joonwoo Park16f1ddd2017-02-16 12:52:16 -08001645
1646TRACE_EVENT(sched_group_energy,
1647
1648 TP_PROTO(int cpu, long group_util, u64 total_nrg,
1649 int busy_nrg, int idle_nrg, int grp_idle_idx,
1650 int new_capacity),
1651
1652 TP_ARGS(cpu, group_util, total_nrg,
1653 busy_nrg, idle_nrg, grp_idle_idx,
1654 new_capacity),
1655
1656 TP_STRUCT__entry(
1657 __field(int, cpu)
1658 __field(long, group_util)
1659 __field(u64, total_nrg)
1660 __field(int, busy_nrg)
1661 __field(int, idle_nrg)
1662 __field(int, grp_idle_idx)
1663 __field(int, new_capacity)
1664 ),
1665
1666 TP_fast_assign(
1667 __entry->cpu = cpu;
1668 __entry->group_util = group_util;
1669 __entry->total_nrg = total_nrg;
1670 __entry->busy_nrg = busy_nrg;
1671 __entry->idle_nrg = idle_nrg;
1672 __entry->grp_idle_idx = grp_idle_idx;
1673 __entry->new_capacity = new_capacity;
1674 ),
1675
1676 TP_printk("cpu=%d group_util=%ld total_nrg=%llu busy_nrg=%d idle_nrg=%d grp_idle_idx=%d new_capacity=%d",
1677 __entry->cpu, __entry->group_util,
1678 __entry->total_nrg, __entry->busy_nrg, __entry->idle_nrg,
1679 __entry->grp_idle_idx, __entry->new_capacity)
1680);
1681
Patrick Bellasi5824d982016-01-20 14:06:05 +00001682/*
1683 * Tracepoint for schedtune_tasks_update
1684 */
1685TRACE_EVENT(sched_tune_filter,
Patrick Bellasi5824d982016-01-20 14:06:05 +00001686 TP_PROTO(int nrg_delta, int cap_delta,
1687 int nrg_gain, int cap_gain,
1688 int payoff, int region),
Patrick Bellasi5824d982016-01-20 14:06:05 +00001689 TP_ARGS(nrg_delta, cap_delta, nrg_gain, cap_gain, payoff, region),
Patrick Bellasi5824d982016-01-20 14:06:05 +00001690 TP_STRUCT__entry(
1691 __field( int, nrg_delta )
1692 __field( int, cap_delta )
1693 __field( int, nrg_gain )
1694 __field( int, cap_gain )
1695 __field( int, payoff )
1696 __field( int, region )
1697 ),
Patrick Bellasi5824d982016-01-20 14:06:05 +00001698 TP_fast_assign(
1699 __entry->nrg_delta = nrg_delta;
1700 __entry->cap_delta = cap_delta;
1701 __entry->nrg_gain = nrg_gain;
1702 __entry->cap_gain = cap_gain;
1703 __entry->payoff = payoff;
1704 __entry->region = region;
1705 ),
Patrick Bellasi5824d982016-01-20 14:06:05 +00001706 TP_printk("nrg_delta=%d cap_delta=%d nrg_gain=%d cap_gain=%d payoff=%d region=%d",
1707 __entry->nrg_delta, __entry->cap_delta,
1708 __entry->nrg_gain, __entry->cap_gain,
1709 __entry->payoff, __entry->region)
1710);
Patrick Bellasi8e45d942016-02-10 09:24:36 +00001711/*
1712 * Tracepoint for system overutilized flag
1713 */
1714TRACE_EVENT(sched_overutilized,
Patrick Bellasi8e45d942016-02-10 09:24:36 +00001715 TP_PROTO(bool overutilized),
Patrick Bellasi8e45d942016-02-10 09:24:36 +00001716 TP_ARGS(overutilized),
Patrick Bellasi8e45d942016-02-10 09:24:36 +00001717 TP_STRUCT__entry(
1718 __field( bool, overutilized )
1719 ),
Patrick Bellasi8e45d942016-02-10 09:24:36 +00001720 TP_fast_assign(
1721 __entry->overutilized = overutilized;
1722 ),
Patrick Bellasi8e45d942016-02-10 09:24:36 +00001723 TP_printk("overutilized=%d",
1724 __entry->overutilized ? 1 : 0)
1725);
Jeevan Shriram49f575e2017-03-02 16:52:44 -08001726#endif
Srivatsa Vaddagiri26c21542016-05-31 09:08:38 -07001727
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -07001728TRACE_EVENT(sched_get_nr_running_avg,
1729
Pavankumar Kondeti005309282017-05-10 15:43:29 +05301730 TP_PROTO(int avg, int big_avg, int iowait_avg,
1731 unsigned int max_nr, unsigned int big_max_nr),
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -07001732
Pavankumar Kondeti005309282017-05-10 15:43:29 +05301733 TP_ARGS(avg, big_avg, iowait_avg, max_nr, big_max_nr),
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -07001734
1735 TP_STRUCT__entry(
1736 __field( int, avg )
1737 __field( int, big_avg )
1738 __field( int, iowait_avg )
Pavankumar Kondeti005309282017-05-10 15:43:29 +05301739 __field( unsigned int, max_nr )
1740 __field( unsigned int, big_max_nr )
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -07001741 ),
1742
1743 TP_fast_assign(
1744 __entry->avg = avg;
1745 __entry->big_avg = big_avg;
1746 __entry->iowait_avg = iowait_avg;
Pavankumar Kondeti005309282017-05-10 15:43:29 +05301747 __entry->max_nr = max_nr;
1748 __entry->big_max_nr = big_max_nr;
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -07001749 ),
1750
Pavankumar Kondeti005309282017-05-10 15:43:29 +05301751 TP_printk("avg=%d big_avg=%d iowait_avg=%d max_nr=%u big_max_nr=%u",
1752 __entry->avg, __entry->big_avg, __entry->iowait_avg,
1753 __entry->max_nr, __entry->big_max_nr)
Syed Rameez Mustafadddcab72016-09-07 16:18:27 -07001754);
Olav Haugan39432ea2016-06-12 13:57:05 -07001755
Olav Haugan09bcc682016-09-02 17:12:20 -07001756TRACE_EVENT(core_ctl_eval_need,
1757
1758 TP_PROTO(unsigned int cpu, unsigned int old_need,
1759 unsigned int new_need, unsigned int updated),
1760 TP_ARGS(cpu, old_need, new_need, updated),
1761 TP_STRUCT__entry(
1762 __field(u32, cpu)
1763 __field(u32, old_need)
1764 __field(u32, new_need)
1765 __field(u32, updated)
1766 ),
1767 TP_fast_assign(
1768 __entry->cpu = cpu;
1769 __entry->old_need = old_need;
1770 __entry->new_need = new_need;
1771 __entry->updated = updated;
1772 ),
1773 TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu,
1774 __entry->old_need, __entry->new_need, __entry->updated)
1775);
1776
1777TRACE_EVENT(core_ctl_set_busy,
1778
1779 TP_PROTO(unsigned int cpu, unsigned int busy,
1780 unsigned int old_is_busy, unsigned int is_busy),
1781 TP_ARGS(cpu, busy, old_is_busy, is_busy),
1782 TP_STRUCT__entry(
1783 __field(u32, cpu)
1784 __field(u32, busy)
1785 __field(u32, old_is_busy)
1786 __field(u32, is_busy)
1787 ),
1788 TP_fast_assign(
1789 __entry->cpu = cpu;
1790 __entry->busy = busy;
1791 __entry->old_is_busy = old_is_busy;
1792 __entry->is_busy = is_busy;
1793 ),
1794 TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u",
1795 __entry->cpu, __entry->busy, __entry->old_is_busy,
1796 __entry->is_busy)
1797);
1798
Olav Haugana024f472016-10-13 10:34:11 -07001799TRACE_EVENT(core_ctl_set_boost,
1800
1801 TP_PROTO(u32 refcount, s32 ret),
1802 TP_ARGS(refcount, ret),
1803 TP_STRUCT__entry(
1804 __field(u32, refcount)
1805 __field(s32, ret)
1806 ),
1807 TP_fast_assign(
1808 __entry->refcount = refcount;
1809 __entry->ret = ret;
1810 ),
1811 TP_printk("refcount=%u, ret=%d", __entry->refcount, __entry->ret)
1812);
1813
Olav Haugan39432ea2016-06-12 13:57:05 -07001814/*
1815 * sched_isolate - called when cores are isolated/unisolated
1816 *
1817 * @acutal_mask: mask of cores actually isolated/unisolated
1818 * @req_mask: mask of cores requested isolated/unisolated
1819 * @online_mask: cpu online mask
1820 * @time: amount of time in us it took to isolate/unisolate
1821 * @isolate: 1 if isolating, 0 if unisolating
1822 *
1823 */
1824TRACE_EVENT(sched_isolate,
1825
1826 TP_PROTO(unsigned int requested_cpu, unsigned int isolated_cpus,
1827 u64 start_time, unsigned char isolate),
1828
1829 TP_ARGS(requested_cpu, isolated_cpus, start_time, isolate),
1830
1831 TP_STRUCT__entry(
1832 __field(u32, requested_cpu)
1833 __field(u32, isolated_cpus)
1834 __field(u32, time)
1835 __field(unsigned char, isolate)
1836 ),
1837
1838 TP_fast_assign(
1839 __entry->requested_cpu = requested_cpu;
1840 __entry->isolated_cpus = isolated_cpus;
1841 __entry->time = div64_u64(sched_clock() - start_time, 1000);
1842 __entry->isolate = isolate;
1843 ),
1844
1845 TP_printk("iso cpu=%u cpus=0x%x time=%u us isolated=%d",
1846 __entry->requested_cpu, __entry->isolated_cpus,
1847 __entry->time, __entry->isolate)
1848);
Steven Rostedtea20d922009-04-10 08:54:16 -04001849#endif /* _TRACE_SCHED_H */
Steven Rostedta8d154b2009-04-10 09:36:00 -04001850
1851/* This part must be outside protection */
1852#include <trace/define_trace.h>