aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/hrtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time/hrtimer.c')
-rw-r--r--kernel/time/hrtimer.c40
1 files changed, 5 insertions, 35 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index d13c9aebf7a3..9ba7c820fc23 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1590,7 +1590,7 @@ SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
1590/* 1590/*
1591 * Functions related to boot-time initialization: 1591 * Functions related to boot-time initialization:
1592 */ 1592 */
1593static void init_hrtimers_cpu(int cpu) 1593int hrtimers_prepare_cpu(unsigned int cpu)
1594{ 1594{
1595 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); 1595 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);
1596 int i; 1596 int i;
@@ -1602,6 +1602,7 @@ static void init_hrtimers_cpu(int cpu)
1602 1602
1603 cpu_base->cpu = cpu; 1603 cpu_base->cpu = cpu;
1604 hrtimer_init_hres(cpu_base); 1604 hrtimer_init_hres(cpu_base);
1605 return 0;
1605} 1606}
1606 1607
1607#ifdef CONFIG_HOTPLUG_CPU 1608#ifdef CONFIG_HOTPLUG_CPU
@@ -1636,7 +1637,7 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
1636 } 1637 }
1637} 1638}
1638 1639
1639static void migrate_hrtimers(int scpu) 1640int hrtimers_dead_cpu(unsigned int scpu)
1640{ 1641{
1641 struct hrtimer_cpu_base *old_base, *new_base; 1642 struct hrtimer_cpu_base *old_base, *new_base;
1642 int i; 1643 int i;
@@ -1665,45 +1666,14 @@ static void migrate_hrtimers(int scpu)
1665 /* Check, if we got expired work to do */ 1666 /* Check, if we got expired work to do */
1666 __hrtimer_peek_ahead_timers(); 1667 __hrtimer_peek_ahead_timers();
1667 local_irq_enable(); 1668 local_irq_enable();
1669 return 0;
1668} 1670}
1669 1671
1670#endif /* CONFIG_HOTPLUG_CPU */ 1672#endif /* CONFIG_HOTPLUG_CPU */
1671 1673
1672static int hrtimer_cpu_notify(struct notifier_block *self,
1673 unsigned long action, void *hcpu)
1674{
1675 int scpu = (long)hcpu;
1676
1677 switch (action) {
1678
1679 case CPU_UP_PREPARE:
1680 case CPU_UP_PREPARE_FROZEN:
1681 init_hrtimers_cpu(scpu);
1682 break;
1683
1684#ifdef CONFIG_HOTPLUG_CPU
1685 case CPU_DEAD:
1686 case CPU_DEAD_FROZEN:
1687 migrate_hrtimers(scpu);
1688 break;
1689#endif
1690
1691 default:
1692 break;
1693 }
1694
1695 return NOTIFY_OK;
1696}
1697
1698static struct notifier_block hrtimers_nb = {
1699 .notifier_call = hrtimer_cpu_notify,
1700};
1701
1702void __init hrtimers_init(void) 1674void __init hrtimers_init(void)
1703{ 1675{
1704 hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE, 1676 hrtimers_prepare_cpu(smp_processor_id());
1705 (void *)(long)smp_processor_id());
1706 register_cpu_notifier(&hrtimers_nb);
1707} 1677}
1708 1678
1709/** 1679/**