rcu: Remove "cpu" argument to rcu_needs_cpu()
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 21 Oct 2014 20:23:08 +0000 (13:23 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 4 Nov 2014 03:20:43 +0000 (19:20 -0800)
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>
include/linux/rcupdate.h
include/linux/rcutree.h
kernel/rcu/tree.c
kernel/rcu/tree_plugin.h
kernel/time/tick-sched.c

index b4ad275d90d0c0539f791a8faa56bb37a2b3e749..4eb810832b19c1fbbf00ecb524ee64c7ef2ddf85 100644 (file)
@@ -1103,7 +1103,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
        __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
 
 #if defined(CONFIG_TINY_RCU) || defined(CONFIG_RCU_NOCB_CPU_ALL)
-static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
+static inline int rcu_needs_cpu(unsigned long *delta_jiffies)
 {
        *delta_jiffies = ULONG_MAX;
        return 0;
index 7b5484db18573343742af53a3c739e1ceb42f971..52953790dcca2089527ec9f48725fd7d31fb0da0 100644 (file)
@@ -32,7 +32,7 @@
 
 void rcu_note_context_switch(void);
 #ifndef CONFIG_RCU_NOCB_CPU_ALL
-int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies);
+int rcu_needs_cpu(unsigned long *delta_jiffies);
 #endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */
 void rcu_cpu_stall_reset(void);
 
index b591f14592400958b8af397869fda9de53974a9e..d678a98caf1d0d86fed7ffaa8c5881a0ac70e090 100644 (file)
@@ -3159,7 +3159,7 @@ static int rcu_pending(void)
  * non-NULL, store an indication of whether all callbacks are lazy.
  * (If there are no callbacks, all of them are deemed to be lazy.)
  */
-static int __maybe_unused rcu_cpu_has_callbacks(int cpu, bool *all_lazy)
+static int __maybe_unused rcu_cpu_has_callbacks(bool *all_lazy)
 {
        bool al = true;
        bool hc = false;
@@ -3167,7 +3167,7 @@ static int __maybe_unused rcu_cpu_has_callbacks(int cpu, bool *all_lazy)
        struct rcu_state *rsp;
 
        for_each_rcu_flavor(rsp) {
-               rdp = per_cpu_ptr(rsp->rda, cpu);
+               rdp = this_cpu_ptr(rsp->rda);
                if (!rdp->nxtlist)
                        continue;
                hc = true;
index 495d4cce47a7d215404b1fd2f65b1c90608a1e1f..1797b76cb3ffac2f18339867451e9c2f4dcbd26f 100644 (file)
@@ -1512,10 +1512,10 @@ static void rcu_prepare_kthreads(int cpu)
  * any flavor of RCU.
  */
 #ifndef CONFIG_RCU_NOCB_CPU_ALL
-int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
+int rcu_needs_cpu(unsigned long *delta_jiffies)
 {
        *delta_jiffies = ULONG_MAX;
-       return rcu_cpu_has_callbacks(cpu, NULL);
+       return rcu_cpu_has_callbacks(NULL);
 }
 #endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */
 
@@ -1624,15 +1624,15 @@ static bool __maybe_unused rcu_try_advance_all_cbs(void)
  * The caller must have disabled interrupts.
  */
 #ifndef CONFIG_RCU_NOCB_CPU_ALL
-int rcu_needs_cpu(int cpu, unsigned long *dj)
+int rcu_needs_cpu(unsigned long *dj)
 {
-       struct rcu_dynticks *rdtp = &per_cpu(rcu_dynticks, cpu);
+       struct rcu_dynticks *rdtp = this_cpu_ptr(&rcu_dynticks);
 
        /* Snapshot to detect later posting of non-lazy callback. */
        rdtp->nonlazy_posted_snap = rdtp->nonlazy_posted;
 
        /* If no callbacks, RCU doesn't need the CPU. */
-       if (!rcu_cpu_has_callbacks(cpu, &rdtp->all_lazy)) {
+       if (!rcu_cpu_has_callbacks(&rdtp->all_lazy)) {
                *dj = ULONG_MAX;
                return 0;
        }
@@ -1679,7 +1679,7 @@ static void rcu_prepare_for_idle(int cpu)
        /* Handle nohz enablement switches conservatively. */
        tne = ACCESS_ONCE(tick_nohz_active);
        if (tne != rdtp->tick_nohz_enabled_snap) {
-               if (rcu_cpu_has_callbacks(cpu, NULL))
+               if (rcu_cpu_has_callbacks(NULL))
                        invoke_rcu_core(); /* force nohz to see update. */
                rdtp->tick_nohz_enabled_snap = tne;
                return;
index 7b5741fc411007825ec0ba0839caf4e0870e46e3..1f4356037a7d5e1068c148640757870c1f3854d3 100644 (file)
@@ -585,7 +585,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
                last_jiffies = jiffies;
        } while (read_seqretry(&jiffies_lock, seq));
 
-       if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) ||
+       if (rcu_needs_cpu(&rcu_delta_jiffies) ||
            arch_needs_cpu() || irq_work_needs_cpu()) {
                next_jiffies = last_jiffies + 1;
                delta_jiffies = 1;