tracing: Fix typo in prof_sysexit_enable()
[safe/jmp/linux-2.6] / kernel / sched.c
index 6c571bd..c535cc4 100644 (file)
@@ -26,8 +26,6 @@
  *              Thomas Gleixner, Mike Kravetz
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/nmi.h>
@@ -2034,30 +2032,23 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
        return delta < (s64)sysctl_sched_migration_cost;
 }
 
-
 void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 {
-       int old_cpu = task_cpu(p);
-       struct cfs_rq *old_cfsrq = task_cfs_rq(p),
-                     *new_cfsrq = cpu_cfs_rq(old_cfsrq, new_cpu);
-
 #ifdef CONFIG_SCHED_DEBUG
        /*
         * We should never call set_task_cpu() on a blocked task,
         * ttwu() will sort out the placement.
         */
-       WARN_ON(p->state != TASK_RUNNING && p->state != TASK_WAKING);
+       WARN_ON_ONCE(p->state != TASK_RUNNING && p->state != TASK_WAKING &&
+                       !(task_thread_info(p)->preempt_count & PREEMPT_ACTIVE));
 #endif
 
        trace_sched_migrate_task(p, new_cpu);
 
-       if (old_cpu != new_cpu) {
+       if (task_cpu(p) != new_cpu) {
                p->se.nr_migrations++;
-               perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS,
-                                    1, 1, NULL, 0);
+               perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
        }
-       p->se.vruntime -= old_cfsrq->min_vruntime -
-                                        new_cfsrq->min_vruntime;
 
        __set_task_cpu(p, new_cpu);
 }
@@ -2354,7 +2345,7 @@ int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags)
         *   not worry about this generic constraint ]
         */
        if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) ||
-                    !cpu_active(cpu)))
+                    !cpu_online(cpu)))
                cpu = select_fallback_rq(task_cpu(p), p);
 
        return cpu;
@@ -5381,8 +5372,8 @@ static noinline void __schedule_bug(struct task_struct *prev)
 {
        struct pt_regs *regs = get_irq_regs();
 
-       pr_err("BUG: scheduling while atomic: %s/%d/0x%08x\n",
-              prev->comm, prev->pid, preempt_count());
+       printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
+               prev->comm, prev->pid, preempt_count());
 
        debug_show_held_locks(prev);
        print_modules();
@@ -6946,23 +6937,23 @@ void sched_show_task(struct task_struct *p)
        unsigned state;
 
        state = p->state ? __ffs(p->state) + 1 : 0;
-       pr_info("%-13.13s %c", p->comm,
+       printk(KERN_INFO "%-13.13s %c", p->comm,
                state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
 #if BITS_PER_LONG == 32
        if (state == TASK_RUNNING)
-               pr_cont(" running  ");
+               printk(KERN_CONT " running  ");
        else
-               pr_cont(" %08lx ", thread_saved_pc(p));
+               printk(KERN_CONT " %08lx ", thread_saved_pc(p));
 #else
        if (state == TASK_RUNNING)
-               pr_cont("  running task    ");
+               printk(KERN_CONT "  running task    ");
        else
-               pr_cont(" %016lx ", thread_saved_pc(p));
+               printk(KERN_CONT " %016lx ", thread_saved_pc(p));
 #endif
 #ifdef CONFIG_DEBUG_STACK_USAGE
        free = stack_not_used(p);
 #endif
-       pr_cont("%5lu %5d %6d 0x%08lx\n", free,
+       printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free,
                task_pid_nr(p), task_pid_nr(p->real_parent),
                (unsigned long)task_thread_info(p)->flags);
 
@@ -6974,9 +6965,11 @@ void show_state_filter(unsigned long state_filter)
        struct task_struct *g, *p;
 
 #if BITS_PER_LONG == 32
-       pr_info("  task                PC stack   pid father\n");
+       printk(KERN_INFO
+               "  task                PC stack   pid father\n");
 #else
-       pr_info("  task                        PC stack   pid father\n");
+       printk(KERN_INFO
+               "  task                        PC stack   pid father\n");
 #endif
        read_lock(&tasklist_lock);
        do_each_thread(g, p) {
@@ -7834,44 +7827,48 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
        printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
 
        if (!(sd->flags & SD_LOAD_BALANCE)) {
-               pr_cont("does not load-balance\n");
+               printk("does not load-balance\n");
                if (sd->parent)
-                       pr_err("ERROR: !SD_LOAD_BALANCE domain has parent\n");
+                       printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
+                                       " has parent");
                return -1;
        }
 
-       pr_cont("span %s level %s\n", str, sd->name);
+       printk(KERN_CONT "span %s level %s\n", str, sd->name);
 
        if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
-               pr_err("ERROR: domain->span does not contain CPU%d\n", cpu);
+               printk(KERN_ERR "ERROR: domain->span does not contain "
+                               "CPU%d\n", cpu);
        }
        if (!cpumask_test_cpu(cpu, sched_group_cpus(group))) {
-               pr_err("ERROR: domain->groups does not contain CPU%d\n", cpu);
+               printk(KERN_ERR "ERROR: domain->groups does not contain"
+                               " CPU%d\n", cpu);
        }
 
        printk(KERN_DEBUG "%*s groups:", level + 1, "");
        do {
                if (!group) {
-                       pr_cont("\n");
-                       pr_err("ERROR: group is NULL\n");
+                       printk("\n");
+                       printk(KERN_ERR "ERROR: group is NULL\n");
                        break;
                }
 
                if (!group->cpu_power) {
-                       pr_cont("\n");
-                       pr_err("ERROR: domain->cpu_power not set\n");
+                       printk(KERN_CONT "\n");
+                       printk(KERN_ERR "ERROR: domain->cpu_power not "
+                                       "set\n");
                        break;
                }
 
                if (!cpumask_weight(sched_group_cpus(group))) {
-                       pr_cont("\n");
-                       pr_err("ERROR: empty group\n");
+                       printk(KERN_CONT "\n");
+                       printk(KERN_ERR "ERROR: empty group\n");
                        break;
                }
 
                if (cpumask_intersects(groupmask, sched_group_cpus(group))) {
-                       pr_cont("\n");
-                       pr_err("ERROR: repeated CPUs\n");
+                       printk(KERN_CONT "\n");
+                       printk(KERN_ERR "ERROR: repeated CPUs\n");
                        break;
                }
 
@@ -7879,21 +7876,23 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 
                cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group));
 
-               pr_cont(" %s", str);
+               printk(KERN_CONT " %s", str);
                if (group->cpu_power != SCHED_LOAD_SCALE) {
-                       pr_cont(" (cpu_power = %d)", group->cpu_power);
+                       printk(KERN_CONT " (cpu_power = %d)",
+                               group->cpu_power);
                }
 
                group = group->next;
        } while (group != sd->groups);
-       pr_cont("\n");
+       printk(KERN_CONT "\n");
 
        if (!cpumask_equal(sched_domain_span(sd), groupmask))
-               pr_err("ERROR: groups don't span domain->span\n");
+               printk(KERN_ERR "ERROR: groups don't span domain->span\n");
 
        if (sd->parent &&
            !cpumask_subset(groupmask, sched_domain_span(sd->parent)))
-               pr_err("ERROR: parent span is not a superset of domain->span\n");
+               printk(KERN_ERR "ERROR: parent span is not a superset "
+                       "of domain->span\n");
        return 0;
 }
 
@@ -8449,7 +8448,8 @@ static int build_numa_sched_groups(struct s_data *d,
        sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(),
                          GFP_KERNEL, num);
        if (!sg) {
-               pr_warning("Can not alloc domain group for node %d\n", num);
+               printk(KERN_WARNING "Can not alloc domain group for node %d\n",
+                      num);
                return -ENOMEM;
        }
        d->sched_group_nodes[num] = sg;
@@ -8478,8 +8478,8 @@ static int build_numa_sched_groups(struct s_data *d,
                sg = kmalloc_node(sizeof(struct sched_group) + cpumask_size(),
                                  GFP_KERNEL, num);
                if (!sg) {
-                       pr_warning("Can not alloc domain group for node %d\n",
-                                  j);
+                       printk(KERN_WARNING
+                              "Can not alloc domain group for node %d\n", j);
                        return -ENOMEM;
                }
                sg->cpu_power = 0;
@@ -8707,7 +8707,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
        d->sched_group_nodes = kcalloc(nr_node_ids,
                                      sizeof(struct sched_group *), GFP_KERNEL);
        if (!d->sched_group_nodes) {
-               pr_warning("Can not alloc sched group node list\n");
+               printk(KERN_WARNING "Can not alloc sched group node list\n");
                return sa_notcovered;
        }
        sched_group_nodes_bycpu[cpumask_first(cpu_map)] = d->sched_group_nodes;
@@ -8724,7 +8724,7 @@ static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
                return sa_send_covered;
        d->rd = alloc_rootdomain();
        if (!d->rd) {
-               pr_warning("Cannot alloc root domain\n");
+               printk(KERN_WARNING "Cannot alloc root domain\n");
                return sa_tmpmask;
        }
        return sa_rootdomain;
@@ -9689,7 +9689,7 @@ void __init sched_init(void)
 #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
 static inline int preempt_count_equals(int preempt_offset)
 {
-       int nested = preempt_count() & ~PREEMPT_ACTIVE;
+       int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
 
        return (nested == PREEMPT_INATOMIC_BASE + preempt_offset);
 }
@@ -9706,11 +9706,13 @@ void __might_sleep(char *file, int line, int preempt_offset)
                return;
        prev_jiffy = jiffies;
 
-       pr_err("BUG: sleeping function called from invalid context at %s:%d\n",
-              file, line);
-       pr_err("in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
-              in_atomic(), irqs_disabled(),
-              current->pid, current->comm);
+       printk(KERN_ERR
+               "BUG: sleeping function called from invalid context at %s:%d\n",
+                       file, line);
+       printk(KERN_ERR
+               "in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
+                       in_atomic(), irqs_disabled(),
+                       current->pid, current->comm);
 
        debug_show_held_locks(current);
        if (irqs_disabled())
@@ -10102,7 +10104,7 @@ void sched_move_task(struct task_struct *tsk)
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
        if (tsk->sched_class->moved_group)
-               tsk->sched_class->moved_group(tsk);
+               tsk->sched_class->moved_group(tsk, on_rq);
 #endif
 
        if (unlikely(running))