diff options
| -rw-r--r-- | fs/proc/array.c | 19 | ||||
| -rw-r--r-- | include/linux/rcutiny.h | 5 | ||||
| -rw-r--r-- | include/linux/rcutree.h | 11 | ||||
| -rw-r--r-- | include/linux/sched.h | 13 | ||||
| -rw-r--r-- | init/main.c | 7 | ||||
| -rw-r--r-- | kernel/cpu.c | 24 | ||||
| -rw-r--r-- | kernel/kthread.c | 23 | ||||
| -rw-r--r-- | kernel/sched.c | 401 | ||||
| -rw-r--r-- | kernel/sched_clock.c | 23 | ||||
| -rw-r--r-- | kernel/sched_fair.c | 53 | ||||
| -rw-r--r-- | kernel/sched_idletask.c | 2 | ||||
| -rw-r--r-- | kernel/sched_rt.c | 4 |
12 files changed, 336 insertions, 249 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 4badde179b18..f560325c444f 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
| @@ -134,13 +134,16 @@ static inline void task_name(struct seq_file *m, struct task_struct *p) | |||
| 134 | * simple bit tests. | 134 | * simple bit tests. |
| 135 | */ | 135 | */ |
| 136 | static const char *task_state_array[] = { | 136 | static const char *task_state_array[] = { |
| 137 | "R (running)", /* 0 */ | 137 | "R (running)", /* 0 */ |
| 138 | "S (sleeping)", /* 1 */ | 138 | "S (sleeping)", /* 1 */ |
| 139 | "D (disk sleep)", /* 2 */ | 139 | "D (disk sleep)", /* 2 */ |
| 140 | "T (stopped)", /* 4 */ | 140 | "T (stopped)", /* 4 */ |
| 141 | "T (tracing stop)", /* 8 */ | 141 | "t (tracing stop)", /* 8 */ |
| 142 | "Z (zombie)", /* 16 */ | 142 | "Z (zombie)", /* 16 */ |
| 143 | "X (dead)" /* 32 */ | 143 | "X (dead)", /* 32 */ |
| 144 | "x (dead)", /* 64 */ | ||
| 145 | "K (wakekill)", /* 128 */ | ||
| 146 | "W (waking)", /* 256 */ | ||
| 144 | }; | 147 | }; |
| 145 | 148 | ||
| 146 | static inline const char *get_task_state(struct task_struct *tsk) | 149 | static inline const char *get_task_state(struct task_struct *tsk) |
| @@ -148,6 +151,8 @@ static inline const char *get_task_state(struct task_struct *tsk) | |||
| 148 | unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; | 151 | unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; |
| 149 | const char **p = &task_state_array[0]; | 152 | const char **p = &task_state_array[0]; |
| 150 | 153 | ||
| 154 | BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array)); | ||
| 155 | |||
| 151 | while (state) { | 156 | while (state) { |
| 152 | p++; | 157 | p++; |
| 153 | state >>= 1; | 158 | state >>= 1; |
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index c4ba9a78721e..96cc307ed9f4 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
| @@ -101,4 +101,9 @@ static inline void exit_rcu(void) | |||
| 101 | { | 101 | { |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static inline int rcu_preempt_depth(void) | ||
| 105 | { | ||
| 106 | return 0; | ||
| 107 | } | ||
| 108 | |||
| 104 | #endif /* __LINUX_RCUTINY_H */ | 109 | #endif /* __LINUX_RCUTINY_H */ |
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index c93eee5911b0..8044b1b94333 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
| @@ -45,6 +45,12 @@ extern void __rcu_read_unlock(void); | |||
| 45 | extern void synchronize_rcu(void); | 45 | extern void synchronize_rcu(void); |
| 46 | extern void exit_rcu(void); | 46 | extern void exit_rcu(void); |
| 47 | 47 | ||
| 48 | /* | ||
| 49 | * Defined as macro as it is a very low level header | ||
| 50 | * included from areas that don't even know about current | ||
| 51 | */ | ||
| 52 | #define rcu_preempt_depth() (current->rcu_read_lock_nesting) | ||
| 53 | |||
| 48 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 54 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 49 | 55 | ||
| 50 | static inline void __rcu_read_lock(void) | 56 | static inline void __rcu_read_lock(void) |
| @@ -63,6 +69,11 @@ static inline void exit_rcu(void) | |||
| 63 | { | 69 | { |
| 64 | } | 70 | } |
| 65 | 71 | ||
| 72 | static inline int rcu_preempt_depth(void) | ||
| 73 | { | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 66 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ | 77 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 67 | 78 | ||
| 68 | static inline void __rcu_read_lock_bh(void) | 79 | static inline void __rcu_read_lock_bh(void) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index e89857812be6..f2f842db03ce 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -192,6 +192,12 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
| 192 | #define TASK_DEAD 64 | 192 | #define TASK_DEAD 64 |
| 193 | #define TASK_WAKEKILL 128 | 193 | #define TASK_WAKEKILL 128 |
| 194 | #define TASK_WAKING 256 | 194 | #define TASK_WAKING 256 |
| 195 | #define TASK_STATE_MAX 512 | ||
| 196 | |||
| 197 | #define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" | ||
| 198 | |||
| 199 | extern char ___assert_task_state[1 - 2*!!( | ||
| 200 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; | ||
| 195 | 201 | ||
| 196 | /* Convenience macros for the sake of set_task_state */ | 202 | /* Convenience macros for the sake of set_task_state */ |
| 197 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) | 203 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) |
| @@ -1091,7 +1097,8 @@ struct sched_class { | |||
| 1091 | enum cpu_idle_type idle); | 1097 | enum cpu_idle_type idle); |
| 1092 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 1098 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
| 1093 | void (*post_schedule) (struct rq *this_rq); | 1099 | void (*post_schedule) (struct rq *this_rq); |
| 1094 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 1100 | void (*task_waking) (struct rq *this_rq, struct task_struct *task); |
| 1101 | void (*task_woken) (struct rq *this_rq, struct task_struct *task); | ||
| 1095 | 1102 | ||
| 1096 | void (*set_cpus_allowed)(struct task_struct *p, | 1103 | void (*set_cpus_allowed)(struct task_struct *p, |
| 1097 | const struct cpumask *newmask); | 1104 | const struct cpumask *newmask); |
| @@ -1115,7 +1122,7 @@ struct sched_class { | |||
| 1115 | struct task_struct *task); | 1122 | struct task_struct *task); |
| 1116 | 1123 | ||
| 1117 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1124 | #ifdef CONFIG_FAIR_GROUP_SCHED |
| 1118 | void (*moved_group) (struct task_struct *p); | 1125 | void (*moved_group) (struct task_struct *p, int on_rq); |
| 1119 | #endif | 1126 | #endif |
| 1120 | }; | 1127 | }; |
| 1121 | 1128 | ||
| @@ -2594,8 +2601,6 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
| 2594 | } | 2601 | } |
| 2595 | #endif /* CONFIG_MM_OWNER */ | 2602 | #endif /* CONFIG_MM_OWNER */ |
| 2596 | 2603 | ||
| 2597 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | ||
| 2598 | |||
| 2599 | #endif /* __KERNEL__ */ | 2604 | #endif /* __KERNEL__ */ |
| 2600 | 2605 | ||
| 2601 | #endif | 2606 | #endif |
diff --git a/init/main.c b/init/main.c index c3db4a98b369..dac44a9356a5 100644 --- a/init/main.c +++ b/init/main.c | |||
| @@ -369,12 +369,6 @@ static void __init smp_init(void) | |||
| 369 | { | 369 | { |
| 370 | unsigned int cpu; | 370 | unsigned int cpu; |
| 371 | 371 | ||
| 372 | /* | ||
| 373 | * Set up the current CPU as possible to migrate to. | ||
| 374 | * The other ones will be done by cpu_up/cpu_down() | ||
| 375 | */ | ||
| 376 | set_cpu_active(smp_processor_id(), true); | ||
| 377 | |||
| 378 | /* FIXME: This should be done in userspace --RR */ | 372 | /* FIXME: This should be done in userspace --RR */ |
| 379 | for_each_present_cpu(cpu) { | 373 | for_each_present_cpu(cpu) { |
| 380 | if (num_online_cpus() >= setup_max_cpus) | 374 | if (num_online_cpus() >= setup_max_cpus) |
| @@ -486,6 +480,7 @@ static void __init boot_cpu_init(void) | |||
| 486 | int cpu = smp_processor_id(); | 480 | int cpu = smp_processor_id(); |
| 487 | /* Mark the boot cpu "present", "online" etc for SMP and UP case */ | 481 | /* Mark the boot cpu "present", "online" etc for SMP and UP case */ |
| 488 | set_cpu_online(cpu, true); | 482 | set_cpu_online(cpu, true); |
| 483 | set_cpu_active(cpu, true); | ||
| 489 | set_cpu_present(cpu, true); | 484 | set_cpu_present(cpu, true); |
| 490 | set_cpu_possible(cpu, true); | 485 | set_cpu_possible(cpu, true); |
| 491 | } | 486 | } |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 291ac586f37f..1c8ddd6ee940 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
| @@ -209,6 +209,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) | |||
| 209 | return -ENOMEM; | 209 | return -ENOMEM; |
| 210 | 210 | ||
| 211 | cpu_hotplug_begin(); | 211 | cpu_hotplug_begin(); |
| 212 | set_cpu_active(cpu, false); | ||
| 212 | err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod, | 213 | err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod, |
| 213 | hcpu, -1, &nr_calls); | 214 | hcpu, -1, &nr_calls); |
| 214 | if (err == NOTIFY_BAD) { | 215 | if (err == NOTIFY_BAD) { |
| @@ -280,18 +281,6 @@ int __ref cpu_down(unsigned int cpu) | |||
| 280 | goto out; | 281 | goto out; |
| 281 | } | 282 | } |
| 282 | 283 | ||
| 283 | set_cpu_active(cpu, false); | ||
| 284 | |||
| 285 | /* | ||
| 286 | * Make sure the all cpus did the reschedule and are not | ||
| 287 | * using stale version of the cpu_active_mask. | ||
| 288 | * This is not strictly necessary becuase stop_machine() | ||
| 289 | * that we run down the line already provides the required | ||
| 290 | * synchronization. But it's really a side effect and we do not | ||
| 291 | * want to depend on the innards of the stop_machine here. | ||
| 292 | */ | ||
| 293 | synchronize_sched(); | ||
| 294 | |||
| 295 | err = _cpu_down(cpu, 0); | 284 | err = _cpu_down(cpu, 0); |
| 296 | 285 | ||
| 297 | out: | 286 | out: |
| @@ -382,19 +371,12 @@ int disable_nonboot_cpus(void) | |||
| 382 | return error; | 371 | return error; |
| 383 | cpu_maps_update_begin(); | 372 | cpu_maps_update_begin(); |
| 384 | first_cpu = cpumask_first(cpu_online_mask); | 373 | first_cpu = cpumask_first(cpu_online_mask); |
| 385 | /* We take down all of the non-boot CPUs in one shot to avoid races | 374 | /* |
| 375 | * We take down all of the non-boot CPUs in one shot to avoid races | ||
| 386 | * with the userspace trying to use the CPU hotplug at the same time | 376 | * with the userspace trying t |
