diff options
author | Amit Pundir <amit.pundir@linaro.org> | 2017-02-23 16:02:45 -0800 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2018-09-14 00:30:54 +0530 |
commit | d82a8035d09bcfcac238b80ad97335167665a7c3 (patch) | |
tree | eec2069a95cdff0a4de9cf215d9b4365dac384a9 | |
parent | 441e17f79c4a092bba3450b8b4d4eeec7e5d6729 (diff) | |
download | linaro-android-test/amt-4.19.tar.gz |
ANDROID: idle_notifier: Add generic idle notifierstest/amt-4.19
AOSP Change-ID: Idf29cda15be151f494ff245933c12462643388d5
moved x86_64 idle notifiers as generic so that they can
be used in interactive governor.
Upstream change 8e7a7ee9ddd5 ("x86/idle: Remove idle_notifier")
removed x86_64 idle notifiers altogether. This patch add
generic idle notifiers again.
Fixes: android-4.9 commit bfd2a547fc17 ("ANDROID: ARM: Call idle notifiers")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
-rw-r--r-- | include/linux/cpu.h | 7 | ||||
-rw-r--r-- | kernel/cpu.c | 20 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 218df7f4d3e1..1bf10aadbc93 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -189,4 +189,11 @@ static inline void cpu_smt_check_topology_early(void) { } static inline void cpu_smt_check_topology(void) { } #endif +#define IDLE_START 1 +#define IDLE_END 2 + +void idle_notifier_register(struct notifier_block *n); +void idle_notifier_unregister(struct notifier_block *n); +void idle_notifier_call_chain(unsigned long val); + #endif /* _LINUX_CPU_H_ */ diff --git a/kernel/cpu.c b/kernel/cpu.c index f3f6250da722..519813598ff8 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -2290,3 +2290,23 @@ void __init boot_cpu_hotplug_init(void) #endif this_cpu_write(cpuhp_state.state, CPUHP_ONLINE); } + +static ATOMIC_NOTIFIER_HEAD(idle_notifier); + +void idle_notifier_register(struct notifier_block *n) +{ + atomic_notifier_chain_register(&idle_notifier, n); +} +EXPORT_SYMBOL_GPL(idle_notifier_register); + +void idle_notifier_unregister(struct notifier_block *n) +{ + atomic_notifier_chain_unregister(&idle_notifier, n); +} +EXPORT_SYMBOL_GPL(idle_notifier_unregister); + +void idle_notifier_call_chain(unsigned long val) +{ + atomic_notifier_call_chain(&idle_notifier, val, NULL); +} +EXPORT_SYMBOL_GPL(idle_notifier_call_chain); |