diff options
| author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-10-21 16:23:08 -0400 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-11-03 22:20:43 -0500 |
| commit | aa6da5140b784ece799f670bf532096f67aa7785 (patch) | |
| tree | 23cbf7f15431d83ef85ddf0ce23e2ba44ea5cad5 /kernel | |
| parent | 38200cf24702e5d79ce6c8f4c62036c41845c62d (diff) | |
rcu: Remove "cpu" argument to rcu_needs_cpu()
The "cpu" argument to rcu_needs_cpu() is always the current CPU, so drop
it. This in turn allows the "cpu" argument to rcu_cpu_has_callbacks()
to be removed, which allows the uses of "cpu" in both functions to be
replaced with a this_cpu_ptr(). Again, the anticipated cross-CPU uses
of these functions has been replaced by NO_HZ_FULL.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/rcu/tree.c | 4 | ||||
| -rw-r--r-- | kernel/rcu/tree_plugin.h | 12 | ||||
| -rw-r--r-- | kernel/time/tick-sched.c | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index b591f1459240..d678a98caf1d 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
| @@ -3159,7 +3159,7 @@ static int rcu_pending(void) | |||
| 3159 | * non-NULL, store an indication of whether all callbacks are lazy. | 3159 | * non-NULL, store an indication of whether all callbacks are lazy. |
| 3160 | * (If there are no callbacks, all of them are deemed to be lazy.) | 3160 | * (If there are no callbacks, all of them are deemed to be lazy.) |
| 3161 | */ | 3161 | */ |
| 3162 | static int __maybe_unused rcu_cpu_has_callbacks(int cpu, bool *all_lazy) | 3162 | static int __maybe_unused rcu_cpu_has_callbacks(bool *all_lazy) |
| 3163 | { | 3163 | { |
| 3164 | bool al = true; | 3164 | bool al = true; |
| 3165 | bool hc = false; | 3165 | bool hc = false; |
| @@ -3167,7 +3167,7 @@ static int __maybe_unused rcu_cpu_has_callbacks(int cpu, bool *all_lazy) | |||
| 3167 | struct rcu_state *rsp; | 3167 | struct rcu_state *rsp; |
| 3168 | 3168 | ||
| 3169 | for_each_rcu_flavor(rsp) { | 3169 | for_each_rcu_flavor(rsp) { |
| 3170 | rdp = per_cpu_ptr(rsp->rda, cpu); | 3170 | rdp = this_cpu_ptr(rsp->rda); |
| 3171 | if (!rdp->nxtlist) | 3171 | if (!rdp->nxtlist) |
| 3172 | continue; | 3172 | continue; |
| 3173 | hc = true; | 3173 | hc = true; |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 495d4cce47a7..1797b76cb3ff 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
| @@ -1512,10 +1512,10 @@ static void rcu_prepare_kthreads(int cpu) | |||
| 1512 | * any flavor of RCU. | 1512 | * any flavor of RCU. |
| 1513 | */ | 1513 | */ |
| 1514 | #ifndef CONFIG_RCU_NOCB_CPU_ALL | 1514 | #ifndef CONFIG_RCU_NOCB_CPU_ALL |
| 1515 | int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) | 1515 | int rcu_needs_cpu(unsigned long *delta_jiffies) |
| 1516 | { | 1516 | { |
| 1517 | *delta_jiffies = ULONG_MAX; | 1517 | *delta_jiffies = ULONG_MAX; |
| 1518 | return rcu_cpu_has_callbacks(cpu, NULL); | 1518 | return rcu_cpu_has_callbacks(NULL); |
| 1519 | } | 1519 | } |
| 1520 | #endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */ | 1520 | #endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */ |
| 1521 | 1521 | ||
| @@ -1624,15 +1624,15 @@ static bool __maybe_unused rcu_try_advance_all_cbs(void) | |||
| 1624 | * The caller must have disabled interrupts. | 1624 | * The caller must have disabled interrupts. |
| 1625 | */ | 1625 | */ |
| 1626 | #ifndef CONFIG_RCU_NOCB_CPU_ALL | 1626 | #ifndef CONFIG_RCU_NOCB_CPU_ALL |
| 1627 | int rcu_needs_cpu(int cpu, unsigned long *dj) | 1627 | int rcu_needs_cpu(unsigned long *dj) |
| 1628 | { | 1628 | { |
| 1629 | struct rcu_dynticks *rdtp = &per_cpu(rcu_dynticks, cpu); | 1629 | struct rcu_dynticks *rdtp = this_cpu_ptr(&rcu_dynticks); |
| 1630 | 1630 | ||
| 1631 | /* Snapshot to detect later posting of non-lazy callback. */ | 1631 | /* Snapshot to detect later posting of non-lazy callback. */ |
| 1632 | rdtp->nonlazy_posted_snap = rdtp->nonlazy_posted; | 1632 | rdtp->nonlazy_posted_snap = rdtp->nonlazy_posted; |
| 1633 | 1633 | ||
| 1634 | /* If no callbacks, RCU doesn't need the CPU. */ | 1634 | /* If no callbacks, RCU doesn't need the CPU. */ |
| 1635 | if (!rcu_cpu_has_callbacks(cpu, &rdtp->all_lazy)) { | 1635 | if (!rcu_cpu_has_callbacks(&rdtp->all_lazy)) { |
| 1636 | *dj = ULONG_MAX; | 1636 | *dj = ULONG_MAX; |
| 1637 | return 0; | 1637 | return 0; |
| 1638 | } | 1638 | } |
| @@ -1679,7 +1679,7 @@ static void rcu_prepare_for_idle(int cpu) | |||
| 1679 | /* Handle nohz enablement switches conservatively. */ | 1679 | /* Handle nohz enablement switches conservatively. */ |
| 1680 | tne = ACCESS_ONCE(tick_nohz_active); | 1680 | tne = ACCESS_ONCE(tick_nohz_active); |
| 1681 | if (tne != rdtp->tick_nohz_enabled_snap) { | 1681 | if (tne != rdtp->tick_nohz_enabled_snap) { |
| 1682 | if (rcu_cpu_has_callbacks(cpu, NULL)) | 1682 | if (rcu_cpu_has_callbacks(NULL)) |
| 1683 | invoke_rcu_core(); /* force nohz to see update. */ | 1683 | invoke_rcu_core(); /* force nohz to see update. */ |
| 1684 | rdtp->tick_nohz_enabled_snap = tne; | 1684 | rdtp->tick_nohz_enabled_snap = tne; |
| 1685 | return; | 1685 | return; |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 7b5741fc4110..1f4356037a7d 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
| @@ -585,7 +585,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts, | |||
| 585 | last_jiffies = jiffies; | 585 | last_jiffies = jiffies; |
| 586 | } while (read_seqretry(&jiffies_lock, seq)); | 586 | } while (read_seqretry(&jiffies_lock, seq)); |
| 587 | 587 | ||
| 588 | if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) || | 588 | if (rcu_needs_cpu(&rcu_delta_jiffies) || |
| 589 | arch_needs_cpu() || irq_work_needs_cpu()) { | 589 | arch_needs_cpu() || irq_work_needs_cpu()) { |
| 590 | next_jiffies = last_jiffies + 1; | 590 | next_jiffies = last_jiffies + 1; |
| 591 | delta_jiffies = 1; | 591 | delta_jiffies = 1; |
