diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-04-14 17:08:39 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-04-22 11:06:49 -0400 |
commit | e19ffe8be2cd0a1f726b235443eba21e64f6be5e (patch) | |
tree | a899fbf4b25ee2158974ebfe8e347f1d42da644f | |
parent | 868a3e915f7f5eba8f8cb4f7da2276760807c51c (diff) |
hrtimer: Use bits for various boolean indicators
No point in wasting 12 byte storage space. Generates better code as well.
Text size reduction:
x8664 -64, i386 -16, ARM -132, ARM64 -0, power64 -48
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20150414203501.227955358@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/hrtimer.h | 6 | ||||
-rw-r--r-- | kernel/time/hrtimer.c | 24 |
2 files changed, 19 insertions, 11 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 5e04f8fc26f6..17a59ddcc79a 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -181,10 +181,10 @@ struct hrtimer_cpu_base { | |||
181 | unsigned int active_bases; | 181 | unsigned int active_bases; |
182 | unsigned int clock_was_set_seq; | 182 | unsigned int clock_was_set_seq; |
183 | #ifdef CONFIG_HIGH_RES_TIMERS | 183 | #ifdef CONFIG_HIGH_RES_TIMERS |
184 | unsigned int in_hrtirq : 1, | ||
185 | hres_active : 1, | ||
186 | hang_detected : 1; | ||
184 | ktime_t expires_next; | 187 | ktime_t expires_next; |
185 | int in_hrtirq; | ||
186 | int hres_active; | ||
187 | int hang_detected; | ||
188 | unsigned int nr_events; | 188 | unsigned int nr_events; |
189 | unsigned int nr_retries; | 189 | unsigned int nr_retries; |
190 | unsigned int nr_hangs; | 190 | unsigned int nr_hangs; |
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 8ce9b3138017..9bbfe33f6575 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
@@ -492,9 +492,14 @@ static inline int hrtimer_is_hres_enabled(void) | |||
492 | /* | 492 | /* |
493 | * Is the high resolution mode active ? | 493 | * Is the high resolution mode active ? |
494 | */ | 494 | */ |
495 | static inline int __hrtimer_hres_active(struct hrtimer_cpu_base *cpu_base) | ||
496 | { | ||
497 | return cpu_base->hres_active; | ||
498 | } | ||
499 | |||
495 | static inline int hrtimer_hres_active(void) | 500 | static inline int hrtimer_hres_active(void) |
496 | { | 501 | { |
497 | return __this_cpu_read(hrtimer_bases.hres_active); | 502 | return __hrtimer_hres_active(this_cpu_ptr(&hrtimer_bases)); |
498 | } | 503 | } |
499 | 504 | ||
500 | /* | 505 | /* |
@@ -628,7 +633,7 @@ static void retrigger_next_event(void *arg) | |||
628 | { | 633 | { |
629 | struct hrtimer_cpu_base *base = this_cpu_ptr(&hrtimer_bases); | 634 | struct hrtimer_cpu_base *base = this_cpu_ptr(&hrtimer_bases); |
630 | 635 | ||
631 | if (!hrtimer_hres_active()) | 636 | if (!base->hres_active) |
632 | return; | 637 | return; |
633 | 638 | ||
634 | raw_spin_lock(&base->lock); | 639 | raw_spin_lock(&base->lock); |
@@ -685,6 +690,7 @@ void clock_was_set_delayed(void) | |||
685 | 690 | ||
686 | #else | 691 | #else |
687 | 692 | ||
693 | static inline int __hrtimer_hres_active(struct hrtimer_cpu_base *b) { return 0; } | ||
688 | static inline int hrtimer_hres_active(void) { return 0; } | 694 | static inline int hrtimer_hres_active(void) { return 0; } |
689 | static inline int hrtimer_is_hres_enabled(void) { return 0; } | 695 | static inline int hrtimer_is_hres_enabled(void) { return 0; } |
690 | static inline int hrtimer_switch_to_hres(void) { return 0; } | 696 | static inline int hrtimer_switch_to_hres(void) { return 0; } |
@@ -862,25 +868,27 @@ static void __remove_hrtimer(struct hrtimer *timer, | |||
862 | struct hrtimer_clock_base *base, | 868 | struct hrtimer_clock_base *base, |
863 | unsigned long newstate, int reprogram) | 869 | unsigned long newstate, int reprogram) |
864 | { | 870 | { |
871 | struct hrtimer_cpu_base *cpu_base = base->cpu_base; | ||
865 | struct timerqueue_node *next_timer; | 872 | struct timerqueue_node *next_timer; |
873 | |||
866 | if (!(timer->state & HRTIMER_STATE_ENQUEUED)) | 874 | if (!(timer->state & HRTIMER_STATE_ENQUEUED)) |
867 | goto out; | 875 | goto out; |
868 | 876 | ||
869 | next_timer = timerqueue_getnext(&base->active); | 877 | next_timer = timerqueue_getnext(&base->active); |
870 | timerqueue_del(&base->active, &timer->node); | 878 | timerqueue_del(&base->active, &timer->node); |
871 | if (!timerqueue_getnext(&base->active)) | 879 | if (!timerqueue_getnext(&base->active)) |
872 | base->cpu_base->active_bases &= ~(1 << base->index); | 880 | cpu_base->active_bases &= ~(1 << base->index); |
873 | 881 | ||
874 | if (&timer->node == next_timer) { | 882 | if (&timer->node == next_timer) { |
875 | #ifdef CONFIG_HIGH_RES_TIMERS | 883 | #ifdef CONFIG_HIGH_RES_TIMERS |
876 | /* Reprogram the clock event device. if enabled */ | 884 | /* Reprogram the clock event device. if enabled */ |
877 | if (reprogram && hrtimer_hres_active()) { | 885 | if (reprogram && cpu_base->hres_active) { |
878 | ktime_t expires; | 886 | ktime_t expires; |
879 | 887 | ||
880 | expires = ktime_sub(hrtimer_get_expires(timer), | 888 | expires = ktime_sub(hrtimer_get_expires(timer), |
881 | base->offset); | 889 | base->offset); |
882 | if (base->cpu_base->expires_next.tv64 == expires.tv64) | 890 | if (cpu_base->expires_next.tv64 == expires.tv64) |
883 | hrtimer_force_reprogram(base->cpu_base, 1); | 891 | hrtimer_force_reprogram(cpu_base, 1); |
884 | } | 892 | } |
885 | #endif | 893 | #endif |
886 | } | 894 | } |
@@ -1114,7 +1122,7 @@ ktime_t hrtimer_get_next_event(void) | |||
1114 | 1122 | ||
1115 | raw_spin_lock_irqsave(&cpu_base->lock, flags); | 1123 | raw_spin_lock_irqsave(&cpu_base->lock, flags); |
1116 | 1124 | ||
1117 | if (!hrtimer_hres_active()) | 1125 | if (!__hrtimer_hres_active(cpu_base)) |
1118 | mindelta = ktime_sub(__hrtimer_get_next_event(cpu_base), | 1126 | mindelta = ktime_sub(__hrtimer_get_next_event(cpu_base), |
1119 | ktime_get()); | 1127 | ktime_get()); |
1120 | 1128 | ||
@@ -1412,7 +1420,7 @@ void hrtimer_run_queues(void) | |||
1412 | struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); | 1420 | struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases); |
1413 | ktime_t now; | 1421 | ktime_t now; |
1414 | 1422 | ||
1415 | if (hrtimer_hres_active()) | 1423 | if (__hrtimer_hres_active(cpu_base)) |
1416 | return; | 1424 | return; |
1417 | 1425 | ||
1418 | raw_spin_lock(&cpu_base->lock); | 1426 | raw_spin_lock(&cpu_base->lock); |