diff options
author | Christoph Lameter <cl@linux.com> | 2014-08-17 13:30:25 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-08-26 13:45:44 -0400 |
commit | 22127e93c587afa01e4f7225d2d1cf1d26ae7dfe (patch) | |
tree | 59e32c175bfe72758e44c1fe1215c13045c80b83 /kernel/time | |
parent | bb964a92ce70ac2039115edd019aa5eef8faa6bb (diff) |
time: Replace __get_cpu_var uses
Convert uses of __get_cpu_var for creating a address from a percpu
offset to this_cpu_ptr.
The two cases where get_cpu_var is used to actually access a percpu
variable are changed to use this_cpu_read/raw_cpu_read.
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/hrtimer.c | 6 | ||||
-rw-r--r-- | kernel/time/tick-broadcast.c | 2 | ||||
-rw-r--r-- | kernel/time/tick-common.c | 6 | ||||
-rw-r--r-- | kernel/time/tick-oneshot.c | 2 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 20 | ||||
-rw-r--r-- | kernel/time/timer.c | 2 |
6 files changed, 19 insertions, 19 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 1c2fe7de2842..5f2229ba53d6 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
@@ -1144,7 +1144,7 @@ static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, | |||
1144 | 1144 | ||
1145 | memset(timer, 0, sizeof(struct hrtimer)); | 1145 | memset(timer, 0, sizeof(struct hrtimer)); |
1146 | 1146 | ||
1147 | cpu_base = &__raw_get_cpu_var(hrtimer_bases); | 1147 | cpu_base = raw_cpu_ptr(&hrtimer_bases); |
1148 | 1148 | ||
1149 | if (clock_id == CLOCK_REALTIME && mode != HRTIMER_MODE_ABS) | 1149 | if (clock_id == CLOCK_REALTIME && mode != HRTIMER_MODE_ABS) |
1150 | clock_id = CLOCK_MONOTONIC; | 1150 | clock_id = CLOCK_MONOTONIC; |
@@ -1187,7 +1187,7 @@ int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) | |||
1187 | struct hrtimer_cpu_base *cpu_base; | 1187 | struct hrtimer_cpu_base *cpu_base; |
1188 | int base = hrtimer_clockid_to_base(which_clock); | 1188 | int base = hrtimer_clockid_to_base(which_clock); |
1189 | 1189 | ||
1190 | cpu_base = &__raw_get_cpu_var(hrtimer_bases); | 1190 | cpu_base = raw_cpu_ptr(&hrtimer_bases); |
1191 | *tp = ktime_to_timespec(cpu_base->clock_base[base].resolution); | 1191 | *tp = ktime_to_timespec(cpu_base->clock_base[base].resolution); |
1192 | 1192 | ||
1193 | return 0; | 1193 | return 0; |
@@ -1376,7 +1376,7 @@ static void __hrtimer_peek_ahead_timers(void) | |||
1376 | if (!hrtimer_hres_active()) | 1376 | if (!hrtimer_hres_active()) |
1377 | return; | 1377 | return; |
1378 | 1378 | ||
1379 | td = &__get_cpu_var(tick_cpu_device); | 1379 | td = this_cpu_ptr(&tick_cpu_device); |
1380 | if (td && td->evtdev) | 1380 | if (td && td->evtdev) |
1381 | hrtimer_interrupt(td->evtdev); | 1381 | hrtimer_interrupt(td->evtdev); |
1382 | } | 1382 | } |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 64c5990fd500..066f0ec05e48 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -554,7 +554,7 @@ int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | |||
554 | void tick_check_oneshot_broadcast_this_cpu(void) | 554 | void tick_check_oneshot_broadcast_this_cpu(void) |
555 | { | 555 | { |
556 | if (cpumask_test_cpu(smp_processor_id(), tick_broadcast_oneshot_mask)) { | 556 | if (cpumask_test_cpu(smp_processor_id(), tick_broadcast_oneshot_mask)) { |
557 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 557 | struct tick_device *td = this_cpu_ptr(&tick_cpu_device); |
558 | 558 | ||
559 | /* | 559 | /* |
560 | * We might be in the middle of switching over from | 560 | * We might be in the middle of switching over from |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 0a0608edeb26..decfb5f6edb0 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -224,7 +224,7 @@ static void tick_setup_device(struct tick_device *td, | |||
224 | 224 | ||
225 | void tick_install_replacement(struct clock_event_device *newdev) | 225 | void tick_install_replacement(struct clock_event_device *newdev) |
226 | { | 226 | { |
227 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 227 | struct tick_device *td = this_cpu_ptr(&tick_cpu_device); |
228 | int cpu = smp_processor_id(); | 228 | int cpu = smp_processor_id(); |
229 | 229 | ||
230 | clockevents_exchange_device(td->evtdev, newdev); | 230 | clockevents_exchange_device(td->evtdev, newdev); |
@@ -374,14 +374,14 @@ void tick_shutdown(unsigned int *cpup) | |||
374 | 374 | ||
375 | void tick_suspend(void) | 375 | void tick_suspend(void) |
376 | { | 376 | { |
377 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 377 | struct tick_device *td = this_cpu_ptr(&tick_cpu_device); |
378 | 378 | ||
379 | clockevents_shutdown(td->evtdev); | 379 | clockevents_shutdown(td->evtdev); |
380 | } | 380 | } |
381 | 381 | ||
382 | void tick_resume(void) | 382 | void tick_resume(void) |
383 | { | 383 | { |
384 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 384 | struct tick_device *td = this_cpu_ptr(&tick_cpu_device); |
385 | int broadcast = tick_resume_broadcast(); | 385 | int broadcast = tick_resume_broadcast(); |
386 | 386 | ||
387 | clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_RESUME); | 387 | clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_RESUME); |
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index 824109060a33..7ce740e78e1b 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c | |||
@@ -59,7 +59,7 @@ void tick_setup_oneshot(struct clock_event_device *newdev, | |||
59 | */ | 59 | */ |
60 | int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)) | 60 | int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)) |
61 | { | 61 | { |
62 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 62 | struct tick_device *td = this_cpu_ptr(&tick_cpu_device); |
63 | struct clock_event_device *dev = td->evtdev; | 63 | struct clock_event_device *dev = td->evtdev; |
64 | 64 | ||
65 | if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT) || | 65 | if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT) || |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 99aa6ee3908f..73f90932282b 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -205,7 +205,7 @@ static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now); | |||
205 | */ | 205 | */ |
206 | void __tick_nohz_full_check(void) | 206 | void __tick_nohz_full_check(void) |
207 | { | 207 | { |
208 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 208 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
209 | 209 | ||
210 | if (tick_nohz_full_cpu(smp_processor_id())) { | 210 | if (tick_nohz_full_cpu(smp_processor_id())) { |
211 | if (ts->tick_stopped && !is_idle_task(current)) { | 211 | if (ts->tick_stopped && !is_idle_task(current)) { |
@@ -545,7 +545,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts, | |||
545 | unsigned long seq, last_jiffies, next_jiffies, delta_jiffies; | 545 | unsigned long seq, last_jiffies, next_jiffies, delta_jiffies; |
546 | ktime_t last_update, expires, ret = { .tv64 = 0 }; | 546 | ktime_t last_update, expires, ret = { .tv64 = 0 }; |
547 | unsigned long rcu_delta_jiffies; | 547 | unsigned long rcu_delta_jiffies; |
548 | struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev; | 548 | struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); |
549 | u64 time_delta; | 549 | u64 time_delta; |
550 | 550 | ||
551 | time_delta = timekeeping_max_deferment(); | 551 | time_delta = timekeeping_max_deferment(); |
@@ -813,7 +813,7 @@ void tick_nohz_idle_enter(void) | |||
813 | 813 | ||
814 | local_irq_disable(); | 814 | local_irq_disable(); |
815 | 815 | ||
816 | ts = &__get_cpu_var(tick_cpu_sched); | 816 | ts = this_cpu_ptr(&tick_cpu_sched); |
817 | ts->inidle = 1; | 817 | ts->inidle = 1; |
818 | __tick_nohz_idle_enter(ts); | 818 | __tick_nohz_idle_enter(ts); |
819 | 819 | ||
@@ -831,7 +831,7 @@ EXPORT_SYMBOL_GPL(tick_nohz_idle_enter); | |||
831 | */ | 831 | */ |
832 | void tick_nohz_irq_exit(void) | 832 | void tick_nohz_irq_exit(void) |
833 | { | 833 | { |
834 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 834 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
835 | 835 | ||
836 | if (ts->inidle) | 836 | if (ts->inidle) |
837 | __tick_nohz_idle_enter(ts); | 837 | __tick_nohz_idle_enter(ts); |
@@ -846,7 +846,7 @@ void tick_nohz_irq_exit(void) | |||
846 | */ | 846 | */ |
847 | ktime_t tick_nohz_get_sleep_length(void) | 847 | ktime_t tick_nohz_get_sleep_length(void) |
848 | { | 848 | { |
849 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 849 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
850 | 850 | ||
851 | return ts->sleep_length; | 851 | return ts->sleep_length; |
852 | } | 852 | } |
@@ -959,7 +959,7 @@ static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now) | |||
959 | */ | 959 | */ |
960 | static void tick_nohz_handler(struct clock_event_device *dev) | 960 | static void tick_nohz_handler(struct clock_event_device *dev) |
961 | { | 961 | { |
962 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 962 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
963 | struct pt_regs *regs = get_irq_regs(); | 963 | struct pt_regs *regs = get_irq_regs(); |
964 | ktime_t now = ktime_get(); | 964 | ktime_t now = ktime_get(); |
965 | 965 | ||
@@ -979,7 +979,7 @@ static void tick_nohz_handler(struct clock_event_device *dev) | |||
979 | */ | 979 | */ |
980 | static void tick_nohz_switch_to_nohz(void) | 980 | static void tick_nohz_switch_to_nohz(void) |
981 | { | 981 | { |
982 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 982 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
983 | ktime_t next; | 983 | ktime_t next; |
984 | 984 | ||
985 | if (!tick_nohz_enabled) | 985 | if (!tick_nohz_enabled) |
@@ -1115,7 +1115,7 @@ early_param("skew_tick", skew_tick); | |||
1115 | */ | 1115 | */ |
1116 | void tick_setup_sched_timer(void) | 1116 | void tick_setup_sched_timer(void) |
1117 | { | 1117 | { |
1118 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 1118 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
1119 | ktime_t now = ktime_get(); | 1119 | ktime_t now = ktime_get(); |
1120 | 1120 | ||
1121 | /* | 1121 | /* |
@@ -1184,7 +1184,7 @@ void tick_clock_notify(void) | |||
1184 | */ | 1184 | */ |
1185 | void tick_oneshot_notify(void) | 1185 | void tick_oneshot_notify(void) |
1186 | { | 1186 | { |
1187 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 1187 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
1188 | 1188 | ||
1189 | set_bit(0, &ts->check_clocks); | 1189 | set_bit(0, &ts->check_clocks); |
1190 | } | 1190 | } |
@@ -1199,7 +1199,7 @@ void tick_oneshot_notify(void) | |||
1199 | */ | 1199 | */ |
1200 | int tick_check_oneshot_change(int allow_nohz) | 1200 | int tick_check_oneshot_change(int allow_nohz) |
1201 | { | 1201 | { |
1202 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 1202 | struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); |
1203 | 1203 | ||
1204 | if (!test_and_clear_bit(0, &ts->check_clocks)) | 1204 | if (!test_and_clear_bit(0, &ts->check_clocks)) |
1205 | return 0; | 1205 | return 0; |
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index aca5dfe2fa3d..04d8ed8399b0 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c | |||
@@ -655,7 +655,7 @@ static inline void debug_assert_init(struct timer_list *timer) | |||
655 | static void do_init_timer(struct timer_list *timer, unsigned int flags, | 655 | static void do_init_timer(struct timer_list *timer, unsigned int flags, |
656 | const char *name, struct lock_class_key *key) | 656 | const char *name, struct lock_class_key *key) |
657 | { | 657 | { |
658 | struct tvec_base *base = __raw_get_cpu_var(tvec_bases); | 658 | struct tvec_base *base = raw_cpu_read(tvec_bases); |
659 | 659 | ||
660 | timer->entry.next = NULL; | 660 | timer->entry.next = NULL; |
661 | timer->base = (void *)((unsigned long)base | flags); | 661 | timer->base = (void *)((unsigned long)base | flags); |