rcu: Remove "cpu" argument to rcu_note_context_switch()
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 21 Oct 2014 19:50:04 +0000 (12:50 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 4 Nov 2014 03:20:34 +0000 (19:20 -0800)
The "cpu" argument to rcu_note_context_switch() is always the current
CPU, so drop it.  This in turn allows the "cpu" argument to
rcu_preempt_note_context_switch() to be removed, which allows the sole
use 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/rcutiny.h
include/linux/rcutree.h
kernel/rcu/tree.c
kernel/rcu/tree.h
kernel/rcu/tree_plugin.h
kernel/sched/core.c
kernel/softirq.c

index 38cc5b1e252d2f2ddcc9b2d9e0e1617321ced6d4..0e5366200154e87e394b61c52a60fad72f2050ff 100644 (file)
@@ -78,7 +78,7 @@ static inline void kfree_call_rcu(struct rcu_head *head,
        call_rcu(head, func);
 }
 
-static inline void rcu_note_context_switch(int cpu)
+static inline void rcu_note_context_switch(void)
 {
        rcu_sched_qs();
 }
index 3e2f5d432743cc1fb9a86e8af651a5340ebd5d4e..7b5484db18573343742af53a3c739e1ceb42f971 100644 (file)
@@ -30,7 +30,7 @@
 #ifndef __LINUX_RCUTREE_H
 #define __LINUX_RCUTREE_H
 
-void rcu_note_context_switch(int cpu);
+void rcu_note_context_switch(void);
 #ifndef CONFIG_RCU_NOCB_CPU_ALL
 int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies);
 #endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */
@@ -43,7 +43,7 @@ void rcu_cpu_stall_reset(void);
  */
 static inline void rcu_virt_note_context_switch(int cpu)
 {
-       rcu_note_context_switch(cpu);
+       rcu_note_context_switch();
 }
 
 void synchronize_rcu_bh(void);
index 1af5e2cdcbeb00ec473ea7d8650a76a954275820..b591f14592400958b8af397869fda9de53974a9e 100644 (file)
@@ -286,11 +286,11 @@ static void rcu_momentary_dyntick_idle(void)
  * and requires special handling for preemptible RCU.
  * The caller must have disabled preemption.
  */
-void rcu_note_context_switch(int cpu)
+void rcu_note_context_switch(void)
 {
        trace_rcu_utilization(TPS("Start context switch"));
        rcu_sched_qs();
-       rcu_preempt_note_context_switch(cpu);
+       rcu_preempt_note_context_switch();
        if (unlikely(raw_cpu_read(rcu_sched_qs_mask)))
                rcu_momentary_dyntick_idle();
        trace_rcu_utilization(TPS("End context switch"));
index 94a26e330c1b6f42f20a4d2c209c00b34ac9e154..238ac39053fc38d98cd7ed4d5a8fe54317cdebdf 100644 (file)
@@ -547,7 +547,7 @@ DECLARE_PER_CPU(char, rcu_cpu_has_work);
 /* Forward declarations for rcutree_plugin.h */
 static void rcu_bootup_announce(void);
 long rcu_batches_completed(void);
-static void rcu_preempt_note_context_switch(int cpu);
+static void rcu_preempt_note_context_switch(void);
 static int rcu_preempt_blocked_readers_cgp(struct rcu_node *rnp);
 #ifdef CONFIG_HOTPLUG_CPU
 static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp,
index 7158814b7b4a2a4528076c1cdf2fdadfada0367d..495d4cce47a7d215404b1fd2f65b1c90608a1e1f 100644 (file)
@@ -156,7 +156,7 @@ static void rcu_preempt_qs(void)
  *
  * Caller must disable preemption.
  */
-static void rcu_preempt_note_context_switch(int cpu)
+static void rcu_preempt_note_context_switch(void)
 {
        struct task_struct *t = current;
        unsigned long flags;
@@ -167,7 +167,7 @@ static void rcu_preempt_note_context_switch(int cpu)
            !t->rcu_read_unlock_special.b.blocked) {
 
                /* Possibly blocking in an RCU read-side critical section. */
-               rdp = per_cpu_ptr(rcu_preempt_state.rda, cpu);
+               rdp = this_cpu_ptr(rcu_preempt_state.rda);
                rnp = rdp->mynode;
                raw_spin_lock_irqsave(&rnp->lock, flags);
                smp_mb__after_unlock_lock();
@@ -945,7 +945,7 @@ EXPORT_SYMBOL_GPL(rcu_batches_completed);
  * Because preemptible RCU does not exist, we never have to check for
  * CPUs being in quiescent states.
  */
-static void rcu_preempt_note_context_switch(int cpu)
+static void rcu_preempt_note_context_switch(void)
 {
 }
 
index 44999505e1bf6894bdcdb48531a49e5a07b88ac5..cc186945296da3750029ff8adf99bda4efaabb41 100644 (file)
@@ -2802,7 +2802,7 @@ need_resched:
        preempt_disable();
        cpu = smp_processor_id();
        rq = cpu_rq(cpu);
-       rcu_note_context_switch(cpu);
+       rcu_note_context_switch();
        prev = rq->curr;
 
        schedule_debug(prev);
index 0699add19164ca49838ed98538a8f020ae78c1b7..501baa9ac1be3ac37b1a7f7e1204aea2d5456971 100644 (file)
@@ -656,7 +656,7 @@ static void run_ksoftirqd(unsigned int cpu)
                 * in the task stack here.
                 */
                __do_softirq();
-               rcu_note_context_switch(cpu);
+               rcu_note_context_switch();
                local_irq_enable();
                cond_resched();
                return;