Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
"Debug info and other statistics fixes and related enhancements"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/numa: Fix numa balancing stats in /proc/pid/sched
sched/numa: Show numa_group ID in /proc/sched_debug task listings
sched/debug: Move print_cfs_rq() declaration to kernel/sched/sched.h
sched/stat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO=y
sched/stat: Simplify the sched_info accounting dependency

+71 -35
+7 -4
fs/proc/base.c
··· 491 491 } 492 492 #endif 493 493 494 - #ifdef CONFIG_SCHEDSTATS 494 + #ifdef CONFIG_SCHED_INFO 495 495 /* 496 496 * Provides /proc/PID/schedstat 497 497 */ 498 498 static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns, 499 499 struct pid *pid, struct task_struct *task) 500 500 { 501 - seq_printf(m, "%llu %llu %lu\n", 501 + if (unlikely(!sched_info_on())) 502 + seq_printf(m, "0 0 0\n"); 503 + else 504 + seq_printf(m, "%llu %llu %lu\n", 502 505 (unsigned long long)task->se.sum_exec_runtime, 503 506 (unsigned long long)task->sched_info.run_delay, 504 507 task->sched_info.pcount); ··· 2790 2787 #ifdef CONFIG_STACKTRACE 2791 2788 ONE("stack", S_IRUSR, proc_pid_stack), 2792 2789 #endif 2793 - #ifdef CONFIG_SCHEDSTATS 2790 + #ifdef CONFIG_SCHED_INFO 2794 2791 ONE("schedstat", S_IRUGO, proc_pid_schedstat), 2795 2792 #endif 2796 2793 #ifdef CONFIG_LATENCYTOP ··· 3138 3135 #ifdef CONFIG_STACKTRACE 3139 3136 ONE("stack", S_IRUSR, proc_pid_stack), 3140 3137 #endif 3141 - #ifdef CONFIG_SCHEDSTATS 3138 + #ifdef CONFIG_SCHED_INFO 3142 3139 ONE("schedstat", S_IRUGO, proc_pid_schedstat), 3143 3140 #endif 3144 3141 #ifdef CONFIG_LATENCYTOP
+3 -5
include/linux/sched.h
··· 192 192 #ifdef CONFIG_SCHED_DEBUG 193 193 extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); 194 194 extern void proc_sched_set_task(struct task_struct *p); 195 - extern void 196 - print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); 197 195 #endif 198 196 199 197 /* ··· 836 838 struct backing_dev_info; 837 839 struct reclaim_state; 838 840 839 - #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 841 + #ifdef CONFIG_SCHED_INFO 840 842 struct sched_info { 841 843 /* cumulative counters */ 842 844 unsigned long pcount; /* # of times run on this cpu */ ··· 846 848 unsigned long long last_arrival,/* when we last ran on a cpu */ 847 849 last_queued; /* when we were last queued to run */ 848 850 }; 849 - #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ 851 + #endif /* CONFIG_SCHED_INFO */ 850 852 851 853 #ifdef CONFIG_TASK_DELAY_ACCT 852 854 struct task_delay_info { ··· 1395 1397 int rcu_tasks_idle_cpu; 1396 1398 #endif /* #ifdef CONFIG_TASKS_RCU */ 1397 1399 1398 - #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1400 + #ifdef CONFIG_SCHED_INFO 1399 1401 struct sched_info sched_info; 1400 1402 #endif 1401 1403
+1
init/Kconfig
··· 435 435 config TASK_DELAY_ACCT 436 436 bool "Enable per-task delay accounting" 437 437 depends on TASKSTATS 438 + select SCHED_INFO 438 439 help 439 440 Collect information on time spent by a task waiting for system 440 441 resources like cpu, synchronous block I/O completion and swapping
+1 -1
kernel/sched/core.c
··· 2164 2164 set_task_cpu(p, cpu); 2165 2165 raw_spin_unlock_irqrestore(&p->pi_lock, flags); 2166 2166 2167 - #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 2167 + #ifdef CONFIG_SCHED_INFO 2168 2168 if (likely(sched_info_on())) 2169 2169 memset(&p->sched_info, 0, sizeof(p->sched_info)); 2170 2170 #endif
+18 -22
kernel/sched/debug.c
··· 142 142 0LL, 0L); 143 143 #endif 144 144 #ifdef CONFIG_NUMA_BALANCING 145 - SEQ_printf(m, " %d", task_node(p)); 145 + SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p)); 146 146 #endif 147 147 #ifdef CONFIG_CGROUP_SCHED 148 148 SEQ_printf(m, " %s", task_group_path(task_group(p))); ··· 517 517 SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) 518 518 519 519 520 + #ifdef CONFIG_NUMA_BALANCING 521 + void print_numa_stats(struct seq_file *m, int node, unsigned long tsf, 522 + unsigned long tpf, unsigned long gsf, unsigned long gpf) 523 + { 524 + SEQ_printf(m, "numa_faults node=%d ", node); 525 + SEQ_printf(m, "task_private=%lu task_shared=%lu ", tsf, tpf); 526 + SEQ_printf(m, "group_private=%lu group_shared=%lu\n", gsf, gpf); 527 + } 528 + #endif 529 + 530 + 520 531 static void sched_show_numa(struct task_struct *p, struct seq_file *m) 521 532 { 522 533 #ifdef CONFIG_NUMA_BALANCING 523 534 struct mempolicy *pol; 524 - int node, i; 525 535 526 536 if (p->mm) 527 537 P(mm->numa_scan_seq); ··· 543 533 mpol_get(pol); 544 534 task_unlock(p); 545 535 546 - SEQ_printf(m, "numa_migrations, %ld\n", xchg(&p->numa_pages_migrated, 0)); 547 - 548 - for_each_online_node(node) { 549 - for (i = 0; i < 2; i++) { 550 - unsigned long nr_faults = -1; 551 - int cpu_current, home_node; 552 - 553 - if (p->numa_faults) 554 - nr_faults = p->numa_faults[2*node + i]; 555 - 556 - cpu_current = !i ? (task_node(p) == node) : 557 - (pol && node_isset(node, pol->v.nodes)); 558 - 559 - home_node = (p->numa_preferred_nid == node); 560 - 561 - SEQ_printf(m, "numa_faults_memory, %d, %d, %d, %d, %ld\n", 562 - i, node, cpu_current, home_node, nr_faults); 563 - } 564 - } 565 - 536 + P(numa_pages_migrated); 537 + P(numa_preferred_nid); 538 + P(total_numa_faults); 539 + SEQ_printf(m, "current_node=%d, numa_group_id=%d\n", 540 + task_node(p), task_numa_group_id(p)); 541 + show_numa_stats(p, m); 566 542 mpol_put(pol); 567 543 #endif 568 544 }
+21 -1
kernel/sched/fair.c
··· 8473 8473 print_cfs_rq(m, cpu, cfs_rq); 8474 8474 rcu_read_unlock(); 8475 8475 } 8476 - #endif 8476 + 8477 + #ifdef CONFIG_NUMA_BALANCING 8478 + void show_numa_stats(struct task_struct *p, struct seq_file *m) 8479 + { 8480 + int node; 8481 + unsigned long tsf = 0, tpf = 0, gsf = 0, gpf = 0; 8482 + 8483 + for_each_online_node(node) { 8484 + if (p->numa_faults) { 8485 + tsf = p->numa_faults[task_faults_idx(NUMA_MEM, node, 0)]; 8486 + tpf = p->numa_faults[task_faults_idx(NUMA_MEM, node, 1)]; 8487 + } 8488 + if (p->numa_group) { 8489 + gsf = p->numa_group->faults[task_faults_idx(NUMA_MEM, node, 0)], 8490 + gpf = p->numa_group->faults[task_faults_idx(NUMA_MEM, node, 1)]; 8491 + } 8492 + print_numa_stats(m, node, tsf, tpf, gsf, gpf); 8493 + } 8494 + } 8495 + #endif /* CONFIG_NUMA_BALANCING */ 8496 + #endif /* CONFIG_SCHED_DEBUG */ 8477 8497 8478 8498 __init void init_sched_fair_class(void) 8479 8499 {
+13
kernel/sched/sched.h
··· 1689 1689 1690 1690 extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq); 1691 1691 extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq); 1692 + 1693 + #ifdef CONFIG_SCHED_DEBUG 1692 1694 extern void print_cfs_stats(struct seq_file *m, int cpu); 1693 1695 extern void print_rt_stats(struct seq_file *m, int cpu); 1694 1696 extern void print_dl_stats(struct seq_file *m, int cpu); 1697 + extern void 1698 + print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); 1699 + 1700 + #ifdef CONFIG_NUMA_BALANCING 1701 + extern void 1702 + show_numa_stats(struct task_struct *p, struct seq_file *m); 1703 + extern void 1704 + print_numa_stats(struct seq_file *m, int node, unsigned long tsf, 1705 + unsigned long tpf, unsigned long gsf, unsigned long gpf); 1706 + #endif /* CONFIG_NUMA_BALANCING */ 1707 + #endif /* CONFIG_SCHED_DEBUG */ 1695 1708 1696 1709 extern void init_cfs_rq(struct cfs_rq *cfs_rq); 1697 1710 extern void init_rt_rq(struct rt_rq *rt_rq);
+2 -2
kernel/sched/stats.h
··· 47 47 # define schedstat_set(var, val) do { } while (0) 48 48 #endif 49 49 50 - #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 50 + #ifdef CONFIG_SCHED_INFO 51 51 static inline void sched_info_reset_dequeued(struct task_struct *t) 52 52 { 53 53 t->sched_info.last_queued = 0; ··· 156 156 #define sched_info_depart(rq, t) do { } while (0) 157 157 #define sched_info_arrive(rq, next) do { } while (0) 158 158 #define sched_info_switch(rq, t, next) do { } while (0) 159 - #endif /* CONFIG_SCHEDSTATS || CONFIG_TASK_DELAY_ACCT */ 159 + #endif /* CONFIG_SCHED_INFO */ 160 160 161 161 /* 162 162 * The following are functions that support scheduler-internal time accounting.
+5
lib/Kconfig.debug
··· 841 841 that can help debug the scheduler. The runtime overhead of this 842 842 option is minimal. 843 843 844 + config SCHED_INFO 845 + bool 846 + default n 847 + 844 848 config SCHEDSTATS 845 849 bool "Collect scheduler statistics" 846 850 depends on DEBUG_KERNEL && PROC_FS 851 + select SCHED_INFO 847 852 help 848 853 If you say Y here, additional code will be inserted into the 849 854 scheduler and related routines to collect statistics about