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/linux-2.6-tip

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
cpuset: Fix cpuset_cpus_allowed_fallback(), don't update tsk->rt.nr_cpus_allowed
sched: Fix ->min_vruntime calculation in dequeue_entity()
sched: Fix ttwu() for __ARCH_WANT_INTERRUPTS_ON_CTXSW
sched: More sched_domain iterations fixes

+65 -27
+1 -1
include/linux/cpuset.h
··· 146 146 147 147 static inline int cpuset_cpus_allowed_fallback(struct task_struct *p) 148 148 { 149 - cpumask_copy(&p->cpus_allowed, cpu_possible_mask); 149 + do_set_cpus_allowed(p, cpu_possible_mask); 150 150 return cpumask_any(cpu_active_mask); 151 151 } 152 152
+7
include/linux/sched.h
··· 1841 1841 #endif 1842 1842 1843 1843 #ifdef CONFIG_SMP 1844 + extern void do_set_cpus_allowed(struct task_struct *p, 1845 + const struct cpumask *new_mask); 1846 + 1844 1847 extern int set_cpus_allowed_ptr(struct task_struct *p, 1845 1848 const struct cpumask *new_mask); 1846 1849 #else 1850 + static inline void do_set_cpus_allowed(struct task_struct *p, 1851 + const struct cpumask *new_mask) 1852 + { 1853 + } 1847 1854 static inline int set_cpus_allowed_ptr(struct task_struct *p, 1848 1855 const struct cpumask *new_mask) 1849 1856 {
+2 -2
kernel/cpuset.c
··· 2190 2190 rcu_read_lock(); 2191 2191 cs = task_cs(tsk); 2192 2192 if (cs) 2193 - cpumask_copy(&tsk->cpus_allowed, cs->cpus_allowed); 2193 + do_set_cpus_allowed(tsk, cs->cpus_allowed); 2194 2194 rcu_read_unlock(); 2195 2195 2196 2196 /* ··· 2217 2217 * Like above we can temporary set any mask and rely on 2218 2218 * set_cpus_allowed_ptr() as synchronization point. 2219 2219 */ 2220 - cpumask_copy(&tsk->cpus_allowed, cpu_possible_mask); 2220 + do_set_cpus_allowed(tsk, cpu_possible_mask); 2221 2221 cpu = cpumask_any(cpu_active_mask); 2222 2222 } 2223 2223
+2 -2
kernel/kthread.c
··· 202 202 return; 203 203 } 204 204 205 - p->cpus_allowed = cpumask_of_cpu(cpu); 206 - p->rt.nr_cpus_allowed = 1; 205 + /* It's safe because the task is inactive. */ 206 + do_set_cpus_allowed(p, cpumask_of(cpu)); 207 207 p->flags |= PF_THREAD_BOUND; 208 208 } 209 209 EXPORT_SYMBOL(kthread_bind);
+40 -16
kernel/sched.c
··· 2573 2573 if (!next) 2574 2574 smp_send_reschedule(cpu); 2575 2575 } 2576 - #endif 2576 + 2577 + #ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW 2578 + static int ttwu_activate_remote(struct task_struct *p, int wake_flags) 2579 + { 2580 + struct rq *rq; 2581 + int ret = 0; 2582 + 2583 + rq = __task_rq_lock(p); 2584 + if (p->on_cpu) { 2585 + ttwu_activate(rq, p, ENQUEUE_WAKEUP); 2586 + ttwu_do_wakeup(rq, p, wake_flags); 2587 + ret = 1; 2588 + } 2589 + __task_rq_unlock(rq); 2590 + 2591 + return ret; 2592 + 2593 + } 2594 + #endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */ 2595 + #endif /* CONFIG_SMP */ 2577 2596 2578 2597 static void ttwu_queue(struct task_struct *p, int cpu) 2579 2598 { ··· 2650 2631 while (p->on_cpu) { 2651 2632 #ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW 2652 2633 /* 2653 - * If called from interrupt context we could have landed in the 2654 - * middle of schedule(), in this case we should take care not 2655 - * to spin on ->on_cpu if p is current, since that would 2656 - * deadlock. 2634 + * In case the architecture enables interrupts in 2635 + * context_switch(), we cannot busy wait, since that 2636 + * would lead to deadlocks when an interrupt hits and 2637 + * tries to wake up @prev. So bail and do a complete 2638 + * remote wakeup. 2657 2639 */ 2658 - if (p == current) { 2659 - ttwu_queue(p, cpu); 2640 + if (ttwu_activate_remote(p, wake_flags)) 2660 2641 goto stat; 2661 - } 2662 - #endif 2642 + #else 2663 2643 cpu_relax(); 2644 + #endif 2664 2645 } 2665 2646 /* 2666 2647 * Pairs with the smp_wmb() in finish_lock_switch(). ··· 5860 5841 idle->state = TASK_RUNNING; 5861 5842 idle->se.exec_start = sched_clock(); 5862 5843 5863 - cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); 5844 + do_set_cpus_allowed(idle, cpumask_of(cpu)); 5864 5845 /* 5865 5846 * We're having a chicken and egg problem, even though we are 5866 5847 * holding rq->lock, the cpu isn't yet set to this cpu so the ··· 5948 5929 } 5949 5930 5950 5931 #ifdef CONFIG_SMP 5932 + void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) 5933 + { 5934 + if (p->sched_class && p->sched_class->set_cpus_allowed) 5935 + p->sched_class->set_cpus_allowed(p, new_mask); 5936 + else { 5937 + cpumask_copy(&p->cpus_allowed, new_mask); 5938 + p->rt.nr_cpus_allowed = cpumask_weight(new_mask); 5939 + } 5940 + } 5941 + 5951 5942 /* 5952 5943 * This is how migration works: 5953 5944 * ··· 6003 5974 goto out; 6004 5975 } 6005 5976 6006 - if (p->sched_class->set_cpus_allowed) 6007 - p->sched_class->set_cpus_allowed(p, new_mask); 6008 - else { 6009 - cpumask_copy(&p->cpus_allowed, new_mask); 6010 - p->rt.nr_cpus_allowed = cpumask_weight(new_mask); 6011 - } 5977 + do_set_cpus_allowed(p, new_mask); 6012 5978 6013 5979 /* Can the task run on the task's current CPU? If so, we're done */ 6014 5980 if (cpumask_test_cpu(task_cpu(p), new_mask))
+3 -2
kernel/sched_fair.c
··· 1076 1076 se->on_rq = 0; 1077 1077 update_cfs_load(cfs_rq, 0); 1078 1078 account_entity_dequeue(cfs_rq, se); 1079 - update_min_vruntime(cfs_rq); 1080 - update_cfs_shares(cfs_rq); 1081 1079 1082 1080 /* 1083 1081 * Normalize the entity after updating the min_vruntime because the ··· 1084 1086 */ 1085 1087 if (!(flags & DEQUEUE_SLEEP)) 1086 1088 se->vruntime -= cfs_rq->min_vruntime; 1089 + 1090 + update_min_vruntime(cfs_rq); 1091 + update_cfs_shares(cfs_rq); 1087 1092 } 1088 1093 1089 1094 /*
+8 -2
kernel/sched_rt.c
··· 1263 1263 if (!cpumask_test_cpu(this_cpu, lowest_mask)) 1264 1264 this_cpu = -1; /* Skip this_cpu opt if not among lowest */ 1265 1265 1266 + rcu_read_lock(); 1266 1267 for_each_domain(cpu, sd) { 1267 1268 if (sd->flags & SD_WAKE_AFFINE) { 1268 1269 int best_cpu; ··· 1273 1272 * remote processor. 1274 1273 */ 1275 1274 if (this_cpu != -1 && 1276 - cpumask_test_cpu(this_cpu, sched_domain_span(sd))) 1275 + cpumask_test_cpu(this_cpu, sched_domain_span(sd))) { 1276 + rcu_read_unlock(); 1277 1277 return this_cpu; 1278 + } 1278 1279 1279 1280 best_cpu = cpumask_first_and(lowest_mask, 1280 1281 sched_domain_span(sd)); 1281 - if (best_cpu < nr_cpu_ids) 1282 + if (best_cpu < nr_cpu_ids) { 1283 + rcu_read_unlock(); 1282 1284 return best_cpu; 1285 + } 1283 1286 } 1284 1287 } 1288 + rcu_read_unlock(); 1285 1289 1286 1290 /* 1287 1291 * And finally, if there were no matches within the domains
+2 -2
kernel/sched_stats.h
··· 37 37 38 38 #ifdef CONFIG_SMP 39 39 /* domain-specific stats */ 40 - preempt_disable(); 40 + rcu_read_lock(); 41 41 for_each_domain(cpu, sd) { 42 42 enum cpu_idle_type itype; 43 43 ··· 64 64 sd->ttwu_wake_remote, sd->ttwu_move_affine, 65 65 sd->ttwu_move_balance); 66 66 } 67 - preempt_enable(); 67 + rcu_read_unlock(); 68 68 #endif 69 69 } 70 70 kfree(mask_str);