aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c100
1 files changed, 54 insertions, 46 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 720df108a2d6..c535cc4f6428 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -26,8 +26,6 @@
26 * Thomas Gleixner, Mike Kravetz 26 * Thomas Gleixner, Mike Kravetz
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
31#include <linux/mm.h> 29#include <linux/mm.h>
32#include <linux/module.h> 30#include <linux/module.h>
33#include <linux/nmi.h> 31#include <linux/nmi.h>
@@ -2047,11 +2045,10 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
2047 2045
2048 trace_sched_migrate_task(p, new_cpu); 2046 trace_sched_migrate_task(p, new_cpu);
2049 2047
2050 if (task_cpu(p) == new_cpu) 2048 if (task_cpu(p) != new_cpu) {
2051 return; 2049 p->se.nr_migrations++;
2052 2050 perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
2053 p->se.nr_migrations++; 2051 }
2054 perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
2055 2052
2056 __set_task_cpu(p, new_cpu); 2053 __set_task_cpu(p, new_cpu);
2057} 2054}
@@ -2348,7 +2345,7 @@ int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags)
2348 * not worry about this generic constraint ] 2345 * not worry about this generic constraint ]
2349 */ 2346 */
2350 if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) || 2347 if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) ||
2351 !cpu_active(cpu))) 2348 !cpu_online(cpu)))
2352 cpu = select_fallback_rq(task_cpu(p), p); 2349 cpu = select_fallback_rq(task_cpu(p), p);
2353 2350
2354 return cpu; 2351 return cpu;
@@ -5375,8 +5372,8 @@ static noinline void __schedule_bug(struct task_struct *prev)
5375{ 5372{
5376 struct pt_regs *regs = get_irq_regs(); 5373 struct pt_regs *regs = get_irq_regs();
5377 5374
5378 pr_err("BUG: scheduling while atomic: %s/%d/0x%08x\n", 5375 printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
5379 prev->comm, prev->pid, preempt_count()); 5376 prev->comm, prev->pid, preempt_count());
5380 5377
5381 debug_show_held_locks(prev); 5378 debug_show_held_locks(prev);
5382 print_modules(); 5379 print_modules();
@@ -6940,23 +6937,23 @@ void sched_show_task(struct task_struct *p)
6940 unsigned state; 6937 unsigned state;
6941 6938
6942 state = p->state ? __ffs(p->state) + 1 : 0; 6939 state = p->state ? __ffs(p->state) + 1 : 0;
6943 pr_info("%-13.13s %c", p->comm, 6940 printk(KERN_INFO "%-13.13s %c", p->comm,
6944 state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?'); 6941 state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
6945#if BITS_PER_LONG == 32 6942#if BITS_PER_LONG == 32
6946 if (state == TASK_RUNNING) 6943 if (state == TASK_RUNNING)
6947 pr_cont(" running "); 6944 printk(KERN_CONT " running ");
6948 else 6945 else
6949 pr_cont(" %08lx ", thread_saved_pc(p)); 6946 printk(KERN_CONT " %08lx ", thread_saved_pc(p));
6950#else 6947#else
6951 if (state == TASK_RUNNING) 6948 if (state == TASK_RUNNING)
6952 pr_cont(" running task "); 6949 printk(KERN_CONT " running task ");
6953 else 6950 else
6954 pr_cont(" %016lx ", thread_saved_pc(p)); 6951 printk(KERN_CONT " %016lx ", thread_saved_pc(p));
6955#endif 6952#endif
6956#ifdef CONFIG_DEBUG_STACK_USAGE 6953#ifdef CONFIG_DEBUG_STACK_USAGE
6957 free = stack_not_used(p); 6954 free = stack_not_used(p);
6958#endif 6955#endif
6959 pr_cont("%5lu %5d %6d 0x%08lx\n", free, 6956 printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free,
6960 task_pid_nr(p), task_pid_nr(p->real_parent), 6957 task_pid_nr(p), task_pid_nr(p->real_parent),
6961 (unsigned long)task_thread_info(p)->flags); 6958 (unsigned long)task_thread_info(p)->flags);
6962 6959
@@ -6968,9 +6965,11 @@ void show_state_filter(unsigned long state_filter)
6968 struct task_struct *g, *p; 6965 struct task_struct *g, *p;
6969 6966
6970#if BITS_PER_LONG == 32 6967#if BITS_PER_LONG == 32
6971 pr_info(" task PC stack pid father\n"); 6968 printk(KERN_INFO
6969 " task PC stack pid father\n");
6972#else 6970#else
6973 pr_info(" task PC stack pid father\n"); 6971 printk(KERN_INFO
6972 " task PC stack pid father\n");
6974#endif 6973#endif
6975 read_lock(&tasklist_lock); 6974 read_lock(&tasklist_lock);
6976 do_each_thread(g, p) { 6975 do_each_thread(g, p) {
@@ -7828,44 +7827,48 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
7828 printk(KERN_DEBUG "%*s domain %d: ", level, "", level); 7827 printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
7829 7828
7830 if (!(sd->flags & SD_LOAD_BALANCE)) { 7829 if (!(sd->flags & SD_LOAD_BALANCE)) {
7831 pr_cont("does not load-balance\n"); 7830 printk("does not load-balance\n");
7832 if (sd->parent) 7831 if (sd->parent)
7833 pr_err("ERROR: !SD_LOAD_BALANCE domain has parent\n"); 7832 printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
7833 " has parent");
7834 return -1; 7834 return -1;
7835 } 7835 }
7836 7836
7837 pr_cont("span %s level %s\n", str, sd->name); 7837 printk(KERN_CONT "span %s level %s\n", str, sd->name);
7838 7838
7839 if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) { 7839 if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
7840 pr_err("ERROR: domain->span does not contain CPU%d\n", cpu); 7840 printk(KERN_ERR "ERROR: domain->span does not contain "
7841 "CPU%d\n", cpu);
7841 } 7842 }
7842 if (!cpumask_test_cpu(cpu, sched_group_cpus(group))) { 7843 if (!cpumask_test_cpu(cpu, sched_group_cpus(group))) {
7843 pr_err("ERROR: domain->groups does not contain CPU%d\n", cpu); 7844 printk(KERN_ERR "ERROR: domain->groups does not contain"
7845 " CPU%d\n", cpu);
7844 } 7846 }
7845 7847
7846 printk(KERN_DEBUG "%*s groups:", level + 1, ""); 7848 printk(KERN_DEBUG "%*s groups:", level + 1, "");
7847 do { 7849 do {
7848 if (!group) { 7850 if (!group) {
7849 pr_cont("\n"); 7851 printk("\n");
7850 pr_err("ERROR: group is NULL\n"); 7852 printk(KERN_ERR "ERROR: group is NULL\n");
7851 break; 7853 break;
7852 } 7854 }
7853 7855
7854 if (!group->cpu_power) { 7856 if (!group->cpu_power) {
7855 pr_cont("\n"); 7857 printk(KERN_CONT "\n");
7856 pr_err("ERROR: domain->cpu_power not set\n"); 7858 printk(KERN_ERR "ERROR: domain->cpu_power not "
7859 "set\n");
7857 break; 7860 break;
7858 } 7861 }
7859 7862
7860 if (!cpumask_weight(sched_group_cpus(group))) { 7863 if (!cpumask_weight(sched_group_cpus(group))) {
7861 pr_cont("\n"); 7864 printk(KERN_CONT "\n");
7862 pr_err("ERROR: empty group\n"); 7865 printk(KERN_ERR "ERROR: empty group\n");
7863 break; 7866 break;
7864 } 7867 }
7865 7868
7866 if (cpumask_intersects(groupmask, sched_group_cpus(group))) { 7869 if (cpumask_intersects(groupmask, sched_group_cpus(group))) {
7867 pr_cont("\n"); 7870 printk(KERN_CONT "\n");
7868 pr_err("ERROR: repeated CPUs\n"); 7871 printk(KERN_ERR "ERROR: repeated CPUs\n");
7869 break; 7872 break;
7870 } 7873 }
7871 7874
@@ -7873,21 +7876,23 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
7873 7876
7874 cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group)); 7877 cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group));
7875 7878
7876 pr_cont(" %s", str); 7879 printk(KERN_CONT " %s", str);
7877 if (group->cpu_power != SCHED_LOAD_SCALE) { 7880 if (group->cpu_power != SCHED_LOAD_SCALE) {
7878 pr_cont(" (cpu_power = %d)", group->cpu_power); 7881 printk(KERN_CONT " (cpu_power = %d)",
7882 group->cpu_power);
7879 } 7883 }
7880 7884
7881 group = group->next; 7885 group = group->next;
7882 } while (group != sd->groups); 7886 } while (group != sd->groups);
7883 pr_cont("\n"); 7887 printk(KERN_CONT "\n");
7884 7888
7885 if (!cpumask_equal(sched_domain_span(sd), groupmask)) 7889 if (!cpumask_equal(sched_domain_span(sd), groupmask))
7886 pr_err("ERROR: groups don't span domain->span\n"); 7890 printk(KERN_ERR "ERROR: groups don't span domain->span\n");
7887 7891
7888 if (sd->parent && 7892 if (sd->parent &&
7889 !cpumask_subset(groupmask, sched_domain_span(sd->parent))) 7893 !cpumask_subset(groupmask, sched_domain_span(sd->parent)))
7890 pr_err("ERROR: parent span is not a superset of domain->span\n"); 7894 printk(KERN_ERR "ERROR: parent span is not a superset "
7895 "of domain->span\n");
7891 return 0; 7896 return 0;
7892} 7897}
7893 7898
@@ -8443,7 +8448,8 @@ static int build_numa_sched_groups(struct s_data *d,
8443 sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(), 8448 sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(),
8444 GFP_KERNEL, num); 8449 GFP_KERNEL, num);
8445 if (!sg) { 8450 if (!sg) {
8446 pr_warning("Can not alloc domain group for node %d\n", num); 8451 printk(KERN_WARNING "Can not alloc domain group for node %d\n",
8452 num);
8447 return -ENOMEM; 8453 return -ENOMEM;
8448 } 8454 }
8449 d->sched_group_nodes[num] = sg; 8455 d->sched_group_nodes[num] = sg;
@@ -8472,8 +8478,8 @@ static int build_numa_sched_groups(struct s_data *d,
8472 sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(), 8478 sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(),
8473 GFP_KERNEL, num); 8479 GFP_KERNEL, num);
8474 if (!sg) { 8480 if (!sg) {
8475 pr_warning("Can not alloc domain group for node %d\n", 8481 printk(KERN_WARNING
8476 j); 8482 "Can not alloc domain group for node %d\n", j);
8477 return -ENOMEM; 8483 return -ENOMEM;
8478 } 8484 }
8479 sg->cpu_power = 0; 8485 sg->cpu_power = 0;
@@ -8701,7 +8707,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
8701 d->sched_group_nodes = kcalloc(nr_node_ids, 8707 d->sched_group_nodes = kcalloc(nr_node_ids,
8702 sizeof(struct sched_group *), GFP_KERNEL); 8708 sizeof(struct sched_group *), GFP_KERNEL);
8703 if (!d->sched_group_nodes) { 8709 if (!d->sched_group_nodes) {
8704 pr_warning("Can not alloc sched group node list\n"); 8710 printk(KERN_WARNING "Can not alloc sched group node list\n");
8705 return sa_notcovered; 8711 return sa_notcovered;
8706 } 8712 }
8707 sched_group_nodes_bycpu[cpumask_first(cpu_map)] = d->sched_group_nodes; 8713 sched_group_nodes_bycpu[cpumask_first(cpu_map)] = d->sched_group_nodes;
@@ -8718,7 +8724,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
8718 return sa_send_covered; 8724 return sa_send_covered;
8719 d->rd = alloc_rootdomain(); 8725 d->rd = alloc_rootdomain();
8720 if (!d->rd) { 8726 if (!d->rd) {
8721 pr_warning("Cannot alloc root domain\n"); 8727 printk(KERN_WARNING "Cannot alloc root domain\n");
8722 return sa_tmpmask; 8728 return sa_tmpmask;
8723 } 8729 }
8724 return sa_rootdomain; 8730 return sa_rootdomain;
@@ -9700,11 +9706,13 @@ void __might_sleep(char *file, int line, int preempt_offset)
9700 return; 9706 return;
9701 prev_jiffy = jiffies; 9707 prev_jiffy = jiffies;
9702 9708
9703 pr_err("BUG: sleeping function called from invalid context at %s:%d\n", 9709 printk(KERN_ERR
9704 file, line); 9710 "BUG: sleeping function called from invalid context at %s:%d\n",
9705 pr_err("in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n", 9711 file, line);
9706 in_atomic(), irqs_disabled(), 9712 printk(KERN_ERR
9707 current->pid, current->comm); 9713 "in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
9714 in_atomic(), irqs_disabled(),
9715 current->pid, current->comm);
9708 9716
9709 debug_show_held_locks(current); 9717 debug_show_held_locks(current);
9710 if (irqs_disabled()) 9718 if (irqs_disabled())