Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Move x86_64 idle notifiers to generic

Move the x86_64 idle notifiers originally by Andi Kleen and Venkatesh
Pallipadi to generic.

Change-Id: Idf29cda15be151f494ff245933c12462643388d5
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
  • Loading branch information...
commit bb6d70451ca3926a6a4c71fff1cc4a1281e2d681 1 parent 9fbb72d
Todd Poynor authored committed
7 arch/x86/include/asm/idle.h
... ... @@ -1,13 +1,6 @@
1 1 #ifndef _ASM_X86_IDLE_H
2 2 #define _ASM_X86_IDLE_H
3 3
4   -#define IDLE_START 1
5   -#define IDLE_END 2
6   -
7   -struct notifier_block;
8   -void idle_notifier_register(struct notifier_block *n);
9   -void idle_notifier_unregister(struct notifier_block *n);
10   -
11 4 #ifdef CONFIG_X86_64
12 5 void enter_idle(void);
13 6 void exit_idle(void);
18 arch/x86/kernel/process_64.c
@@ -56,31 +56,17 @@ asmlinkage extern void ret_from_fork(void);
56 56 DEFINE_PER_CPU(unsigned long, old_rsp);
57 57 static DEFINE_PER_CPU(unsigned char, is_idle);
58 58
59   -static ATOMIC_NOTIFIER_HEAD(idle_notifier);
60   -
61   -void idle_notifier_register(struct notifier_block *n)
62   -{
63   - atomic_notifier_chain_register(&idle_notifier, n);
64   -}
65   -EXPORT_SYMBOL_GPL(idle_notifier_register);
66   -
67   -void idle_notifier_unregister(struct notifier_block *n)
68   -{
69   - atomic_notifier_chain_unregister(&idle_notifier, n);
70   -}
71   -EXPORT_SYMBOL_GPL(idle_notifier_unregister);
72   -
73 59 void enter_idle(void)
74 60 {
75 61 percpu_write(is_idle, 1);
76   - atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
  62 + idle_notifier_call_chain(IDLE_START);
77 63 }
78 64
79 65 static void __exit_idle(void)
80 66 {
81 67 if (x86_test_and_clear_bit_percpu(0, is_idle) == 0)
82 68 return;
83   - atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
  69 + idle_notifier_call_chain(IDLE_END);
84 70 }
85 71
86 72 /* Called from interrupts to signify idle end */
7 include/linux/cpu.h
@@ -152,4 +152,11 @@ static inline int disable_nonboot_cpus(void) { return 0; }
152 152 static inline void enable_nonboot_cpus(void) {}
153 153 #endif /* !CONFIG_PM_SLEEP_SMP */
154 154
  155 +#define IDLE_START 1
  156 +#define IDLE_END 2
  157 +
  158 +void idle_notifier_register(struct notifier_block *n);
  159 +void idle_notifier_unregister(struct notifier_block *n);
  160 +void idle_notifier_call_chain(unsigned long val);
  161 +
155 162 #endif /* _LINUX_CPU_H_ */
20 kernel/cpu.c
@@ -592,3 +592,23 @@ void init_cpu_online(const struct cpumask *src)
592 592 {
593 593 cpumask_copy(to_cpumask(cpu_online_bits), src);
594 594 }
  595 +
  596 +static ATOMIC_NOTIFIER_HEAD(idle_notifier);
  597 +
  598 +void idle_notifier_register(struct notifier_block *n)
  599 +{
  600 + atomic_notifier_chain_register(&idle_notifier, n);
  601 +}
  602 +EXPORT_SYMBOL_GPL(idle_notifier_register);
  603 +
  604 +void idle_notifier_unregister(struct notifier_block *n)
  605 +{
  606 + atomic_notifier_chain_unregister(&idle_notifier, n);
  607 +}
  608 +EXPORT_SYMBOL_GPL(idle_notifier_unregister);
  609 +
  610 +void idle_notifier_call_chain(unsigned long val)
  611 +{
  612 + atomic_notifier_call_chain(&idle_notifier, val, NULL);
  613 +}
  614 +EXPORT_SYMBOL_GPL(idle_notifier_call_chain);

0 comments on commit bb6d704

Please sign in to comment.
Something went wrong with that request. Please try again.