diff options
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index dccd2f78db4e..bcf7db2f2fd2 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -591,6 +591,35 @@ int rcu_is_cpu_idle(void) | |||
591 | } | 591 | } |
592 | EXPORT_SYMBOL(rcu_is_cpu_idle); | 592 | EXPORT_SYMBOL(rcu_is_cpu_idle); |
593 | 593 | ||
594 | #ifdef CONFIG_HOTPLUG_CPU | ||
595 | |||
596 | /* | ||
597 | * Is the current CPU online? Disable preemption to avoid false positives | ||
598 | * that could otherwise happen due to the current CPU number being sampled, | ||
599 | * this task being preempted, its old CPU being taken offline, resuming | ||
600 | * on some other CPU, then determining that its old CPU is now offline. | ||
601 | * It is OK to use RCU on an offline processor during initial boot, hence | ||
602 | * the check for rcu_scheduler_fully_active. | ||
603 | * | ||
604 | * Disable checking if in an NMI handler because we cannot safely report | ||
605 | * errors from NMI handlers anyway. | ||
606 | */ | ||
607 | bool rcu_lockdep_current_cpu_online(void) | ||
608 | { | ||
609 | bool ret; | ||
610 | |||
611 | if (in_nmi()) | ||
612 | return 1; | ||
613 | preempt_disable(); | ||
614 | ret = cpu_online(smp_processor_id()) || | ||
615 | !rcu_scheduler_fully_active; | ||
616 | preempt_enable(); | ||
617 | return ret; | ||
618 | } | ||
619 | EXPORT_SYMBOL_GPL(rcu_lockdep_current_cpu_online); | ||
620 | |||
621 | #endif /* #ifdef CONFIG_HOTPLUG_CPU */ | ||
622 | |||
594 | #endif /* #ifdef CONFIG_PROVE_RCU */ | 623 | #endif /* #ifdef CONFIG_PROVE_RCU */ |
595 | 624 | ||
596 | /** | 625 | /** |