aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu/tree.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-03-03 17:05:26 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-05-27 15:58:37 -0400
commitea46351cea79f54729d8546e5bd7f091a2e6484b (patch)
treeccb0b53598b72fa8685e2d07b502ee4fce10dde1 /kernel/rcu/tree.c
parent7d0ae8086b828311250c6afdf800b568ac9bd693 (diff)
rcu: Eliminate HOTPLUG_CPU #ifdef in favor of IS_ENABLED()
This commit removes a HOTPLUG_CPU #ifdef, replacing it with IS_ENABLED()-protected return statements. This relies on the optimizer to remove any resulting dead code. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r--kernel/rcu/tree.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 0628df155970..f2e888c8ec5a 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2335,8 +2335,6 @@ rcu_check_quiescent_state(struct rcu_state *rsp, struct rcu_data *rdp)
2335 rcu_report_qs_rdp(rdp->cpu, rsp, rdp); 2335 rcu_report_qs_rdp(rdp->cpu, rsp, rdp);
2336} 2336}
2337 2337
2338#ifdef CONFIG_HOTPLUG_CPU
2339
2340/* 2338/*
2341 * Send the specified CPU's RCU callbacks to the orphanage. The 2339 * Send the specified CPU's RCU callbacks to the orphanage. The
2342 * specified CPU must be offline, and the caller must hold the 2340 * specified CPU must be offline, and the caller must hold the
@@ -2347,7 +2345,7 @@ rcu_send_cbs_to_orphanage(int cpu, struct rcu_state *rsp,
2347 struct rcu_node *rnp, struct rcu_data *rdp) 2345 struct rcu_node *rnp, struct rcu_data *rdp)
2348{ 2346{
2349 /* No-CBs CPUs do not have orphanable callbacks. */ 2347 /* No-CBs CPUs do not have orphanable callbacks. */
2350 if (rcu_is_nocb_cpu(rdp->cpu)) 2348 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU) || rcu_is_nocb_cpu(rdp->cpu))
2351 return; 2349 return;
2352 2350
2353 /* 2351 /*
@@ -2406,7 +2404,8 @@ static void rcu_adopt_orphan_cbs(struct rcu_state *rsp, unsigned long flags)
2406 struct rcu_data *rdp = raw_cpu_ptr(rsp->rda); 2404 struct rcu_data *rdp = raw_cpu_ptr(rsp->rda);
2407 2405
2408 /* No-CBs CPUs are handled specially. */ 2406 /* No-CBs CPUs are handled specially. */
2409 if (rcu_nocb_adopt_orphan_cbs(rsp, rdp, flags)) 2407 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU) ||
2408 rcu_nocb_adopt_orphan_cbs(rsp, rdp, flags))
2410 return; 2409 return;
2411 2410
2412 /* Do the accounting first. */ 2411 /* Do the accounting first. */
@@ -2453,6 +2452,9 @@ static void rcu_cleanup_dying_cpu(struct rcu_state *rsp)
2453 RCU_TRACE(struct rcu_data *rdp = this_cpu_ptr(rsp->rda)); 2452 RCU_TRACE(struct rcu_data *rdp = this_cpu_ptr(rsp->rda));
2454 RCU_TRACE(struct rcu_node *rnp = rdp->mynode); 2453 RCU_TRACE(struct rcu_node *rnp = rdp->mynode);
2455 2454
2455 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
2456 return;
2457
2456 RCU_TRACE(mask = rdp->grpmask); 2458 RCU_TRACE(mask = rdp->grpmask);
2457 trace_rcu_grace_period(rsp->name, 2459 trace_rcu_grace_period(rsp->name,
2458 rnp->gpnum + 1 - !!(rnp->qsmask & mask), 2460 rnp->gpnum + 1 - !!(rnp->qsmask & mask),
@@ -2481,7 +2483,8 @@ static void rcu_cleanup_dead_rnp(struct rcu_node *rnp_leaf)
2481 long mask; 2483 long mask;
2482 struct rcu_node *rnp = rnp_leaf; 2484 struct rcu_node *rnp = rnp_leaf;
2483 2485
2484 if (rnp->qsmaskinit || rcu_preempt_has_tasks(rnp)) 2486 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU) ||
2487 rnp->qsmaskinit || rcu_preempt_has_tasks(rnp))
2485 return; 2488 return;
2486 for (;;) { 2489 for (;;) {
2487 mask = rnp->grpmask; 2490 mask = rnp->grpmask;
@@ -2512,6 +2515,9 @@ static void rcu_cleanup_dying_idle_cpu(int cpu, struct rcu_state *rsp)
2512 struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu); 2515 struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu);
2513 struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */ 2516 struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */
2514 2517
2518 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
2519 return;
2520
2515 /* Remove outgoing CPU from mask in the leaf rcu_node structure. */ 2521 /* Remove outgoing CPU from mask in the leaf rcu_node structure. */
2516 mask = rdp->grpmask; 2522 mask = rdp->grpmask;
2517 raw_spin_lock_irqsave(&rnp->lock, flags); 2523 raw_spin_lock_irqsave(&rnp->lock, flags);
@@ -2533,6 +2539,9 @@ static void rcu_cleanup_dead_cpu(int cpu, struct rcu_state *rsp)
2533 struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu); 2539 struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu);
2534 struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */ 2540 struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */
2535 2541
2542 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
2543 return;
2544
2536 /* Adjust any no-longer-needed kthreads. */ 2545 /* Adjust any no-longer-needed kthreads. */
2537 rcu_boost_kthread_setaffinity(rnp, -1); 2546 rcu_boost_kthread_setaffinity(rnp, -1);
2538 2547
@@ -2547,26 +2556,6 @@ static void rcu_cleanup_dead_cpu(int cpu, struct rcu_state *rsp)
2547 cpu, rdp->qlen, rdp->nxtlist); 2556 cpu, rdp->qlen, rdp->nxtlist);
2548} 2557}
2549 2558
2550#else /* #ifdef CONFIG_HOTPLUG_CPU */
2551
2552static void rcu_cleanup_dying_cpu(struct rcu_state *rsp)
2553{
2554}
2555
2556static void __maybe_unused rcu_cleanup_dead_rnp(struct rcu_node *rnp_leaf)
2557{
2558}
2559
2560static void rcu_cleanup_dying_idle_cpu(int cpu, struct rcu_state *rsp)
2561{
2562}
2563
2564static void rcu_cleanup_dead_cpu(int cpu, struct rcu_state *rsp)
2565{
2566}
2567
2568#endif /* #else #ifdef CONFIG_HOTPLUG_CPU */
2569
2570/* 2559/*
2571 * Invoke any RCU callbacks that have made it to the end of their grace 2560 * Invoke any RCU callbacks that have made it to the end of their grace
2572 * period. Thottle as specified by rdp->blimit. 2561 * period. Thottle as specified by rdp->blimit.