debug.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. /*
  2. * kernel/sched/debug.c
  3. *
  4. * Print the CFS rbtree
  5. *
  6. * Copyright(C) 2007, Red Hat, Inc., Ingo Molnar
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/proc_fs.h>
  13. #include <linux/sched.h>
  14. #include <linux/seq_file.h>
  15. #include <linux/kallsyms.h>
  16. #include <linux/utsname.h>
  17. #include <linux/mempolicy.h>
  18. #include "sched.h"
  19. static DEFINE_SPINLOCK(sched_debug_lock);
  20. /*
  21. * This allows printing both to /proc/sched_debug and
  22. * to the console
  23. */
  24. #define SEQ_printf(m, x...) \
  25. do { \
  26. if (m) \
  27. seq_printf(m, x); \
  28. else \
  29. printk(x); \
  30. } while (0)
  31. /*
  32. * Ease the printing of nsec fields:
  33. */
  34. static long long nsec_high(unsigned long long nsec)
  35. {
  36. if ((long long)nsec < 0) {
  37. nsec = -nsec;
  38. do_div(nsec, 1000000);
  39. return -nsec;
  40. }
  41. do_div(nsec, 1000000);
  42. return nsec;
  43. }
  44. static unsigned long nsec_low(unsigned long long nsec)
  45. {
  46. if ((long long)nsec < 0)
  47. nsec = -nsec;
  48. return do_div(nsec, 1000000);
  49. }
  50. #define SPLIT_NS(x) nsec_high(x), nsec_low(x)
  51. #ifdef CONFIG_FAIR_GROUP_SCHED
  52. static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group *tg)
  53. {
  54. struct sched_entity *se = tg->se[cpu];
  55. #define P(F) \
  56. SEQ_printf(m, " .%-30s: %lld\n", #F, (long long)F)
  57. #define PN(F) \
  58. SEQ_printf(m, " .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)F))
  59. if (!se) {
  60. struct sched_avg *avg = &cpu_rq(cpu)->avg;
  61. P(avg->runnable_avg_sum);
  62. P(avg->runnable_avg_period);
  63. return;
  64. }
  65. PN(se->exec_start);
  66. PN(se->vruntime);
  67. PN(se->sum_exec_runtime);
  68. #ifdef CONFIG_SCHEDSTATS
  69. PN(se->statistics.wait_start);
  70. PN(se->statistics.sleep_start);
  71. PN(se->statistics.block_start);
  72. PN(se->statistics.sleep_max);
  73. PN(se->statistics.block_max);
  74. PN(se->statistics.exec_max);
  75. PN(se->statistics.slice_max);
  76. PN(se->statistics.wait_max);
  77. PN(se->statistics.wait_sum);
  78. P(se->statistics.wait_count);
  79. #endif
  80. P(se->load.weight);
  81. #ifdef CONFIG_SMP
  82. P(se->avg.runnable_avg_sum);
  83. P(se->avg.runnable_avg_period);
  84. P(se->avg.load_avg_contrib);
  85. P(se->avg.decay_count);
  86. #endif
  87. #undef PN
  88. #undef P
  89. }
  90. #endif
  91. #ifdef CONFIG_CGROUP_SCHED
  92. static char group_path[PATH_MAX];
  93. static char *task_group_path(struct task_group *tg)
  94. {
  95. if (autogroup_path(tg, group_path, PATH_MAX))
  96. return group_path;
  97. cgroup_path(tg->css.cgroup, group_path, PATH_MAX);
  98. return group_path;
  99. }
  100. #endif
  101. static void
  102. print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
  103. {
  104. if (rq->curr == p)
  105. SEQ_printf(m, "R");
  106. else
  107. SEQ_printf(m, " ");
  108. SEQ_printf(m, "%15s %5d %9Ld.%06ld %9Ld %5d ",
  109. p->comm, task_pid_nr(p),
  110. SPLIT_NS(p->se.vruntime),
  111. (long long)(p->nvcsw + p->nivcsw),
  112. p->prio);
  113. #ifdef CONFIG_SCHEDSTATS
  114. SEQ_printf(m, "%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld",
  115. SPLIT_NS(p->se.vruntime),
  116. SPLIT_NS(p->se.sum_exec_runtime),
  117. SPLIT_NS(p->se.statistics.sum_sleep_runtime));
  118. #else
  119. SEQ_printf(m, "%15Ld %15Ld %15Ld.%06ld %15Ld.%06ld %15Ld.%06ld",
  120. 0LL, 0LL, 0LL, 0L, 0LL, 0L, 0LL, 0L);
  121. #endif
  122. #ifdef CONFIG_NUMA_BALANCING
  123. SEQ_printf(m, " %d", cpu_to_node(task_cpu(p)));
  124. #endif
  125. #ifdef CONFIG_CGROUP_SCHED
  126. SEQ_printf(m, " %s", task_group_path(task_group(p)));
  127. #endif
  128. SEQ_printf(m, "\n");
  129. }
  130. static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
  131. {
  132. struct task_struct *g, *p;
  133. unsigned long flags;
  134. SEQ_printf(m,
  135. "\nrunnable tasks:\n"
  136. " task PID tree-key switches prio"
  137. " exec-runtime sum-exec sum-sleep\n"
  138. "------------------------------------------------------"
  139. "----------------------------------------------------\n");
  140. read_lock_irqsave(&tasklist_lock, flags);
  141. do_each_thread(g, p) {
  142. if (task_cpu(p) != rq_cpu)
  143. continue;
  144. print_task(m, rq, p);
  145. } while_each_thread(g, p);
  146. read_unlock_irqrestore(&tasklist_lock, flags);
  147. }
  148. void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
  149. {
  150. s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1,
  151. spread, rq0_min_vruntime, spread0;
  152. struct rq *rq = cpu_rq(cpu);
  153. struct sched_entity *last;
  154. unsigned long flags;
  155. #ifdef CONFIG_FAIR_GROUP_SCHED
  156. SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, task_group_path(cfs_rq->tg));
  157. #else
  158. SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu);
  159. #endif
  160. SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock",
  161. SPLIT_NS(cfs_rq->exec_clock));
  162. raw_spin_lock_irqsave(&rq->lock, flags);
  163. if (cfs_rq->rb_leftmost)
  164. MIN_vruntime = (__pick_first_entity(cfs_rq))->vruntime;
  165. last = __pick_last_entity(cfs_rq);
  166. if (last)
  167. max_vruntime = last->vruntime;
  168. min_vruntime = cfs_rq->min_vruntime;
  169. rq0_min_vruntime = cpu_rq(0)->cfs.min_vruntime;
  170. raw_spin_unlock_irqrestore(&rq->lock, flags);
  171. SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "MIN_vruntime",
  172. SPLIT_NS(MIN_vruntime));
  173. SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "min_vruntime",
  174. SPLIT_NS(min_vruntime));
  175. SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "max_vruntime",
  176. SPLIT_NS(max_vruntime));
  177. spread = max_vruntime - MIN_vruntime;
  178. SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread",
  179. SPLIT_NS(spread));
  180. spread0 = min_vruntime - rq0_min_vruntime;
  181. SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread0",
  182. SPLIT_NS(spread0));
  183. SEQ_printf(m, " .%-30s: %d\n", "nr_spread_over",
  184. cfs_rq->nr_spread_over);
  185. SEQ_printf(m, " .%-30s: %d\n", "nr_running", cfs_rq->nr_running);
  186. SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight);
  187. #ifdef CONFIG_SMP
  188. SEQ_printf(m, " .%-30s: %ld\n", "runnable_load_avg",
  189. cfs_rq->runnable_load_avg);
  190. SEQ_printf(m, " .%-30s: %ld\n", "blocked_load_avg",
  191. cfs_rq->blocked_load_avg);
  192. #ifdef CONFIG_FAIR_GROUP_SCHED
  193. SEQ_printf(m, " .%-30s: %ld\n", "tg_load_contrib",
  194. cfs_rq->tg_load_contrib);
  195. SEQ_printf(m, " .%-30s: %d\n", "tg_runnable_contrib",
  196. cfs_rq->tg_runnable_contrib);
  197. SEQ_printf(m, " .%-30s: %ld\n", "tg_load_avg",
  198. atomic_long_read(&cfs_rq->tg->load_avg));
  199. SEQ_printf(m, " .%-30s: %d\n", "tg->runnable_avg",
  200. atomic_read(&cfs_rq->tg->runnable_avg));
  201. #endif
  202. #endif
  203. #ifdef CONFIG_FAIR_GROUP_SCHED
  204. print_cfs_group_stats(m, cpu, cfs_rq->tg);
  205. #endif
  206. }
  207. void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
  208. {
  209. #ifdef CONFIG_RT_GROUP_SCHED
  210. SEQ_printf(m, "\nrt_rq[%d]:%s\n", cpu, task_group_path(rt_rq->tg));
  211. #else
  212. SEQ_printf(m, "\nrt_rq[%d]:\n", cpu);
  213. #endif
  214. #define P(x) \
  215. SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(rt_rq->x))
  216. #define PN(x) \
  217. SEQ_printf(m, " .%-30s: %Ld.%06ld\n", #x, SPLIT_NS(rt_rq->x))
  218. P(rt_nr_running);
  219. P(rt_throttled);
  220. PN(rt_time);
  221. PN(rt_runtime);
  222. #undef PN
  223. #undef P
  224. }
  225. extern __read_mostly int sched_clock_running;
  226. static void print_cpu(struct seq_file *m, int cpu)
  227. {
  228. struct rq *rq = cpu_rq(cpu);
  229. unsigned long flags;
  230. #ifdef CONFIG_X86
  231. {
  232. unsigned int freq = cpu_khz ? : 1;
  233. SEQ_printf(m, "cpu#%d, %u.%03u MHz\n",
  234. cpu, freq / 1000, (freq % 1000));
  235. }
  236. #else
  237. SEQ_printf(m, "cpu#%d\n", cpu);
  238. #endif
  239. #define P(x) \
  240. do { \
  241. if (sizeof(rq->x) == 4) \
  242. SEQ_printf(m, " .%-30s: %ld\n", #x, (long)(rq->x)); \
  243. else \
  244. SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(rq->x));\
  245. } while (0)
  246. #define PN(x) \
  247. SEQ_printf(m, " .%-30s: %Ld.%06ld\n", #x, SPLIT_NS(rq->x))
  248. P(nr_running);
  249. SEQ_printf(m, " .%-30s: %lu\n", "load",
  250. rq->load.weight);
  251. P(nr_switches);
  252. P(nr_load_updates);
  253. P(nr_uninterruptible);
  254. PN(next_balance);
  255. SEQ_printf(m, " .%-30s: %ld\n", "curr->pid", (long)(task_pid_nr(rq->curr)));
  256. PN(clock);
  257. P(cpu_load[0]);
  258. P(cpu_load[1]);
  259. P(cpu_load[2]);
  260. P(cpu_load[3]);
  261. P(cpu_load[4]);
  262. #undef P
  263. #undef PN
  264. #ifdef CONFIG_SCHEDSTATS
  265. #define P(n) SEQ_printf(m, " .%-30s: %d\n", #n, rq->n);
  266. #define P64(n) SEQ_printf(m, " .%-30s: %Ld\n", #n, rq->n);
  267. P(yld_count);
  268. P(sched_count);
  269. P(sched_goidle);
  270. #ifdef CONFIG_SMP
  271. P64(avg_idle);
  272. #endif
  273. P(ttwu_count);
  274. P(ttwu_local);
  275. #undef P
  276. #undef P64
  277. #endif
  278. spin_lock_irqsave(&sched_debug_lock, flags);
  279. print_cfs_stats(m, cpu);
  280. print_rt_stats(m, cpu);
  281. rcu_read_lock();
  282. print_rq(m, rq, cpu);
  283. rcu_read_unlock();
  284. spin_unlock_irqrestore(&sched_debug_lock, flags);
  285. SEQ_printf(m, "\n");
  286. }
  287. static const char *sched_tunable_scaling_names[] = {
  288. "none",
  289. "logaritmic",
  290. "linear"
  291. };
  292. static void sched_debug_header(struct seq_file *m)
  293. {
  294. u64 ktime, sched_clk, cpu_clk;
  295. unsigned long flags;
  296. local_irq_save(flags);
  297. ktime = ktime_to_ns(ktime_get());
  298. sched_clk = sched_clock();
  299. cpu_clk = local_clock();
  300. local_irq_restore(flags);
  301. SEQ_printf(m, "Sched Debug Version: v0.11, %s %.*s\n",
  302. init_utsname()->release,
  303. (int)strcspn(init_utsname()->version, " "),
  304. init_utsname()->version);
  305. #define P(x) \
  306. SEQ_printf(m, "%-40s: %Ld\n", #x, (long long)(x))
  307. #define PN(x) \
  308. SEQ_printf(m, "%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
  309. PN(ktime);
  310. PN(sched_clk);
  311. PN(cpu_clk);
  312. P(jiffies);
  313. #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
  314. P(sched_clock_stable);
  315. #endif
  316. #undef PN
  317. #undef P
  318. SEQ_printf(m, "\n");
  319. SEQ_printf(m, "sysctl_sched\n");
  320. #define P(x) \
  321. SEQ_printf(m, " .%-40s: %Ld\n", #x, (long long)(x))
  322. #define PN(x) \
  323. SEQ_printf(m, " .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
  324. PN(sysctl_sched_latency);
  325. PN(sysctl_sched_min_granularity);
  326. PN(sysctl_sched_wakeup_granularity);
  327. P(sysctl_sched_child_runs_first);
  328. P(sysctl_sched_features);
  329. #undef PN
  330. #undef P
  331. SEQ_printf(m, " .%-40s: %d (%s)\n",
  332. "sysctl_sched_tunable_scaling",
  333. sysctl_sched_tunable_scaling,
  334. sched_tunable_scaling_names[sysctl_sched_tunable_scaling]);
  335. SEQ_printf(m, "\n");
  336. }
  337. static int sched_debug_show(struct seq_file *m, void *v)
  338. {
  339. int cpu = (unsigned long)(v - 2);
  340. if (cpu != -1)
  341. print_cpu(m, cpu);
  342. else
  343. sched_debug_header(m);
  344. return 0;
  345. }
  346. void sysrq_sched_debug_show(void)
  347. {
  348. int cpu;
  349. sched_debug_header(NULL);
  350. for_each_online_cpu(cpu)
  351. print_cpu(NULL, cpu);
  352. }
  353. /*
  354. * This itererator needs some explanation.
  355. * It returns 1 for the header position.
  356. * This means 2 is cpu 0.
  357. * In a hotplugged system some cpus, including cpu 0, may be missing so we have
  358. * to use cpumask_* to iterate over the cpus.
  359. */
  360. static void *sched_debug_start(struct seq_file *file, loff_t *offset)
  361. {
  362. unsigned long n = *offset;
  363. if (n == 0)
  364. return (void *) 1;
  365. n--;
  366. if (n > 0)
  367. n = cpumask_next(n - 1, cpu_online_mask);
  368. else
  369. n = cpumask_first(cpu_online_mask);
  370. *offset = n + 1;
  371. if (n < nr_cpu_ids)
  372. return (void *)(unsigned long)(n + 2);
  373. return NULL;
  374. }
  375. static void *sched_debug_next(struct seq_file *file, void *data, loff_t *offset)
  376. {
  377. (*offset)++;
  378. return sched_debug_start(file, offset);
  379. }
  380. static void sched_debug_stop(struct seq_file *file, void *data)
  381. {
  382. }
  383. static const struct seq_operations sched_debug_sops = {
  384. .start = sched_debug_start,
  385. .next = sched_debug_next,
  386. .stop = sched_debug_stop,
  387. .show = sched_debug_show,
  388. };
  389. static int sched_debug_release(struct inode *inode, struct file *file)
  390. {
  391. seq_release(inode, file);
  392. return 0;
  393. }
  394. static int sched_debug_open(struct inode *inode, struct file *filp)
  395. {
  396. int ret = 0;
  397. ret = seq_open(filp, &sched_debug_sops);
  398. return ret;
  399. }
  400. static const struct file_operations sched_debug_fops = {
  401. .open = sched_debug_open,
  402. .read = seq_read,
  403. .llseek = seq_lseek,
  404. .release = sched_debug_release,
  405. };
  406. static int __init init_sched_debug_procfs(void)
  407. {
  408. struct proc_dir_entry *pe;
  409. pe = proc_create("sched_debug", 0444, NULL, &sched_debug_fops);
  410. if (!pe)
  411. return -ENOMEM;
  412. return 0;
  413. }
  414. __initcall(init_sched_debug_procfs);
  415. #define __P(F) \
  416. SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)F)
  417. #define P(F) \
  418. SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)p->F)
  419. #define __PN(F) \
  420. SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)F))
  421. #define PN(F) \
  422. SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F))
  423. static void sched_show_numa(struct task_struct *p, struct seq_file *m)
  424. {
  425. #ifdef CONFIG_NUMA_BALANCING
  426. struct mempolicy *pol;
  427. int node, i;
  428. if (p->mm)
  429. P(mm->numa_scan_seq);
  430. task_lock(p);
  431. pol = p->mempolicy;
  432. if (pol && !(pol->flags & MPOL_F_MORON))
  433. pol = NULL;
  434. mpol_get(pol);
  435. task_unlock(p);
  436. SEQ_printf(m, "numa_migrations, %ld\n", xchg(&p->numa_pages_migrated, 0));
  437. for_each_online_node(node) {
  438. for (i = 0; i < 2; i++) {
  439. unsigned long nr_faults = -1;
  440. int cpu_current, home_node;
  441. if (p->numa_faults)
  442. nr_faults = p->numa_faults[2*node + i];
  443. cpu_current = !i ? (task_node(p) == node) :
  444. (pol && node_isset(node, pol->v.nodes));
  445. home_node = (p->numa_preferred_nid == node);
  446. SEQ_printf(m, "numa_faults, %d, %d, %d, %d, %ld\n",
  447. i, node, cpu_current, home_node, nr_faults);
  448. }
  449. }
  450. mpol_put(pol);
  451. #endif
  452. }
  453. void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
  454. {
  455. unsigned long nr_switches;
  456. SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, task_pid_nr(p),
  457. get_nr_threads(p));
  458. SEQ_printf(m,
  459. "---------------------------------------------------------"
  460. "----------\n");
  461. #define __P(F) \
  462. SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)F)
  463. #define P(F) \
  464. SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)p->F)
  465. #define __PN(F) \
  466. SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)F))
  467. #define PN(F) \
  468. SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F))
  469. PN(se.exec_start);
  470. PN(se.vruntime);
  471. PN(se.sum_exec_runtime);
  472. nr_switches = p->nvcsw + p->nivcsw;
  473. #ifdef CONFIG_SCHEDSTATS
  474. PN(se.statistics.wait_start);
  475. PN(se.statistics.sleep_start);
  476. PN(se.statistics.block_start);
  477. PN(se.statistics.sleep_max);
  478. PN(se.statistics.block_max);
  479. PN(se.statistics.exec_max);
  480. PN(se.statistics.slice_max);
  481. PN(se.statistics.wait_max);
  482. PN(se.statistics.wait_sum);
  483. P(se.statistics.wait_count);
  484. PN(se.statistics.iowait_sum);
  485. P(se.statistics.iowait_count);
  486. P(se.nr_migrations);
  487. P(se.statistics.nr_migrations_cold);
  488. P(se.statistics.nr_failed_migrations_affine);
  489. P(se.statistics.nr_failed_migrations_running);
  490. P(se.statistics.nr_failed_migrations_hot);
  491. P(se.statistics.nr_forced_migrations);
  492. P(se.statistics.nr_wakeups);
  493. P(se.statistics.nr_wakeups_sync);
  494. P(se.statistics.nr_wakeups_migrate);
  495. P(se.statistics.nr_wakeups_local);
  496. P(se.statistics.nr_wakeups_remote);
  497. P(se.statistics.nr_wakeups_affine);
  498. P(se.statistics.nr_wakeups_affine_attempts);
  499. P(se.statistics.nr_wakeups_passive);
  500. P(se.statistics.nr_wakeups_idle);
  501. {
  502. u64 avg_atom, avg_per_cpu;
  503. avg_atom = p->se.sum_exec_runtime;
  504. if (nr_switches)
  505. do_div(avg_atom, nr_switches);
  506. else
  507. avg_atom = -1LL;
  508. avg_per_cpu = p->se.sum_exec_runtime;
  509. if (p->se.nr_migrations) {
  510. avg_per_cpu = div64_u64(avg_per_cpu,
  511. p->se.nr_migrations);
  512. } else {
  513. avg_per_cpu = -1LL;
  514. }
  515. __PN(avg_atom);
  516. __PN(avg_per_cpu);
  517. }
  518. #endif
  519. __P(nr_switches);
  520. SEQ_printf(m, "%-45s:%21Ld\n",
  521. "nr_voluntary_switches", (long long)p->nvcsw);
  522. SEQ_printf(m, "%-45s:%21Ld\n",
  523. "nr_involuntary_switches", (long long)p->nivcsw);
  524. P(se.load.weight);
  525. #ifdef CONFIG_SMP
  526. P(se.avg.runnable_avg_sum);
  527. P(se.avg.runnable_avg_period);
  528. P(se.avg.load_avg_contrib);
  529. P(se.avg.decay_count);
  530. #endif
  531. P(policy);
  532. P(prio);
  533. #undef PN
  534. #undef __PN
  535. #undef P
  536. #undef __P
  537. {
  538. unsigned int this_cpu = raw_smp_processor_id();
  539. u64 t0, t1;
  540. t0 = cpu_clock(this_cpu);
  541. t1 = cpu_clock(this_cpu);
  542. SEQ_printf(m, "%-45s:%21Ld\n",
  543. "clock-delta", (long long)(t1-t0));
  544. }
  545. sched_show_numa(p, m);
  546. }
  547. void proc_sched_set_task(struct task_struct *p)
  548. {
  549. #ifdef CONFIG_SCHEDSTATS
  550. memset(&p->se.statistics, 0, sizeof(p->se.statistics));
  551. #endif
  552. }