Skip to content

Commit 2be4686

Browse files
author
Frederic Weisbecker
committed
rcu: Introduce rcu_cpu_online()
Export the RCU point of view as to when a CPU is considered offline (ie: when does RCU consider that a CPU is sufficiently down in the hotplug process to not feature any possible read side). This will be used by RCU-tasks whose vision of an offline CPU should reasonably match the one of RCU core. Fixes: cff9b23 ("kernel/sched: Modify initial boot task idle setup") Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent 85d6822 commit 2be4686

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

kernel/rcu/rcu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ static inline void rcu_expedite_gp(void) { }
500500
static inline void rcu_unexpedite_gp(void) { }
501501
static inline void rcu_async_hurry(void) { }
502502
static inline void rcu_async_relax(void) { }
503+
static inline bool rcu_cpu_online(int cpu) { return true; }
503504
#else /* #ifdef CONFIG_TINY_RCU */
504505
bool rcu_gp_is_normal(void); /* Internal RCU use. */
505506
bool rcu_gp_is_expedited(void); /* Internal RCU use. */
@@ -509,6 +510,7 @@ void rcu_unexpedite_gp(void);
509510
void rcu_async_hurry(void);
510511
void rcu_async_relax(void);
511512
void rcupdate_announce_bootup_oddness(void);
513+
bool rcu_cpu_online(int cpu);
512514
#ifdef CONFIG_TASKS_RCU_GENERIC
513515
void show_rcu_tasks_gp_kthreads(void);
514516
#else /* #ifdef CONFIG_TASKS_RCU_GENERIC */

kernel/rcu/tree.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4216,6 +4216,13 @@ static bool rcu_rdp_cpu_online(struct rcu_data *rdp)
42164216
return !!(rdp->grpmask & rcu_rnp_online_cpus(rdp->mynode));
42174217
}
42184218

4219+
bool rcu_cpu_online(int cpu)
4220+
{
4221+
struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu);
4222+
4223+
return rcu_rdp_cpu_online(rdp);
4224+
}
4225+
42194226
#if defined(CONFIG_PROVE_RCU) && defined(CONFIG_HOTPLUG_CPU)
42204227

42214228
/*

0 commit comments

Comments
 (0)