diff options
Diffstat (limited to 'kernel/sched.c')
| -rw-r--r-- | kernel/sched.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 297d1a0eedb..e6f8f125431 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -9534,72 +9534,3 @@ struct cgroup_subsys cpuacct_subsys = { | |||
| 9534 | }; | 9534 | }; |
| 9535 | #endif /* CONFIG_CGROUP_CPUACCT */ | 9535 | #endif /* CONFIG_CGROUP_CPUACCT */ |
| 9536 | 9536 | ||
| 9537 | #ifndef CONFIG_SMP | ||
| 9538 | |||
| 9539 | void synchronize_sched_expedited(void) | ||
| 9540 | { | ||
| 9541 | barrier(); | ||
| 9542 | } | ||
| 9543 | EXPORT_SYMBOL_GPL(synchronize_sched_expedited); | ||
| 9544 | |||
| 9545 | #else /* #ifndef CONFIG_SMP */ | ||
| 9546 | |||
| 9547 | static atomic_t synchronize_sched_expedited_count = ATOMIC_INIT(0); | ||
| 9548 | |||
| 9549 | static int synchronize_sched_expedited_cpu_stop(void *data) | ||
| 9550 | { | ||
| 9551 | /* | ||
| 9552 | * There must be a full memory barrier on each affected CPU | ||
| 9553 | * between the time that try_stop_cpus() is called and the | ||
| 9554 | * time that it returns. | ||
| 9555 | * | ||
| 9556 | * In the current initial implementation of cpu_stop, the | ||
| 9557 | * above condition is already met when the control reaches | ||
| 9558 | * this point and the following smp_mb() is not strictly | ||
| 9559 | * necessary. Do smp_mb() anyway for documentation and | ||
| 9560 | * robustness against future implementation changes. | ||
| 9561 | */ | ||
| 9562 | smp_mb(); /* See above comment block. */ | ||
| 9563 | return 0; | ||
| 9564 | } | ||
| 9565 | |||
| 9566 | /* | ||
| 9567 | * Wait for an rcu-sched grace period to elapse, but use "big hammer" | ||
| 9568 | * approach to force grace period to end quickly. This consumes | ||
| 9569 | * significant time on all CPUs, and is thus not recommended for | ||
| 9570 | * any sort of common-case code. | ||
| 9571 | * | ||
| 9572 | * Note that it is illegal to call this function while holding any | ||
| 9573 | * lock that is acquired by a CPU-hotplug notifier. Failing to | ||
| 9574 | * observe this restriction will result in deadlock. | ||
| 9575 | */ | ||
| 9576 | void synchronize_sched_expedited(void) | ||
| 9577 | { | ||
| 9578 | int snap, trycount = 0; | ||
| 9579 | |||
| 9580 | smp_mb(); /* ensure prior mod happens before capturing snap. */ | ||
| 9581 | snap = atomic_read(&synchronize_sched_expedited_count) + 1; | ||
| 9582 | get_online_cpus(); | ||
| 9583 | while (try_stop_cpus(cpu_online_mask, | ||
| 9584 | synchronize_sched_expedited_cpu_stop, | ||
| 9585 | NULL) == -EAGAIN) { | ||
| 9586 | put_online_cpus(); | ||
| 9587 | if (trycount++ < 10) | ||
| 9588 | udelay(trycount * num_online_cpus()); | ||
| 9589 | else { | ||
| 9590 | synchronize_sched(); | ||
| 9591 | return; | ||
| 9592 | } | ||
| 9593 | if (atomic_read(&synchronize_sched_expedited_count) - snap > 0) { | ||
| 9594 | smp_mb(); /* ensure test happens before caller kfree */ | ||
| 9595 | return; | ||
| 9596 | } | ||
| 9597 | get_online_cpus(); | ||
| 9598 | } | ||
| 9599 | atomic_inc(&synchronize_sched_expedited_count); | ||
| 9600 | smp_mb__after_atomic_inc(); /* ensure post-GP actions seen after GP. */ | ||
| 9601 | put_online_cpus(); | ||
| 9602 | } | ||
| 9603 | EXPORT_SYMBOL_GPL(synchronize_sched_expedited); | ||
| 9604 | |||
| 9605 | #endif /* #else #ifndef CONFIG_SMP */ | ||
