]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
kmemtrace, rcu: fix rcupreempt.c data structure dependencies
authorIngo Molnar <mingo@elte.hu>
Wed, 25 Mar 2009 15:42:24 +0000 (16:42 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 3 Apr 2009 10:23:04 +0000 (12:23 +0200)
Impact: cleanup

We want to remove percpu.h from rcupreempt.h, but if we do that
the percpu primitives there wont build anymore. Move them to the
.c file instead.

Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Cc: paulmck@linux.vnet.ibm.com
LKML-Reference: <1237898630.25315.83.camel@penberg-laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/rcupreempt.h
kernel/rcupreempt.c

index 74304b4538d833ec7bcd26be28bdec8f436d73f7..3eb8fdd19445ee179b25bd571c1043bef0e81ae6 100644 (file)
 #include <linux/cpumask.h>
 #include <linux/seqlock.h>
 
-struct rcu_dyntick_sched {
-       int dynticks;
-       int dynticks_snap;
-       int sched_qs;
-       int sched_qs_snap;
-       int sched_dynticks_snap;
-};
-
-DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
-
-static inline void rcu_qsctr_inc(int cpu)
-{
-       struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
-
-       rdssp->sched_qs++;
-}
-#define rcu_bh_qsctr_inc(cpu)
+extern void rcu_qsctr_inc(int cpu);
+static inline void rcu_bh_qsctr_inc(int cpu) { }
 
 /*
  * Someone might want to pass call_rcu_bh as a function pointer.
  * So this needs to just be a rename and not a macro function.
  *  (no parentheses)
  */
-#define call_rcu_bh            call_rcu
+#define call_rcu_bh            call_rcu
 
 /**
  * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
@@ -117,30 +102,12 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
 struct softirq_action;
 
 #ifdef CONFIG_NO_HZ
-
-static inline void rcu_enter_nohz(void)
-{
-       static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
-
-       smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */
-       __get_cpu_var(rcu_dyntick_sched).dynticks++;
-       WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs);
-}
-
-static inline void rcu_exit_nohz(void)
-{
-       static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
-
-       __get_cpu_var(rcu_dyntick_sched).dynticks++;
-       smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
-       WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
-                               &rs);
-}
-
-#else /* CONFIG_NO_HZ */
-#define rcu_enter_nohz()       do { } while (0)
-#define rcu_exit_nohz()                do { } while (0)
-#endif /* CONFIG_NO_HZ */
+extern void rcu_enter_nohz(void);
+extern void rcu_exit_nohz(void);
+#else
+# define rcu_enter_nohz()      do { } while (0)
+# define rcu_exit_nohz()       do { } while (0)
+#endif
 
 /*
  * A context switch is a grace period for rcupreempt synchronize_rcu()
index 5d59e850fb71f6f58b854cdbd0a1f1792f59c8ad..ce97a4df64d3539edc785ff9db119c3ba3edbe07 100644 (file)
@@ -147,7 +147,51 @@ struct rcu_ctrlblk {
        wait_queue_head_t sched_wq;     /* Place for rcu_sched to sleep. */
 };
 
+struct rcu_dyntick_sched {
+       int dynticks;
+       int dynticks_snap;
+       int sched_qs;
+       int sched_qs_snap;
+       int sched_dynticks_snap;
+};
+
+static DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_dyntick_sched, rcu_dyntick_sched) = {
+       .dynticks = 1,
+};
+
+void rcu_qsctr_inc(int cpu)
+{
+       struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
+
+       rdssp->sched_qs++;
+}
+
+#ifdef CONFIG_NO_HZ
+
+void rcu_enter_nohz(void)
+{
+       static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
+
+       smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */
+       __get_cpu_var(rcu_dyntick_sched).dynticks++;
+       WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs);
+}
+
+void rcu_exit_nohz(void)
+{
+       static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
+
+       __get_cpu_var(rcu_dyntick_sched).dynticks++;
+       smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
+       WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
+                               &rs);
+}
+
+#endif /* CONFIG_NO_HZ */
+
+
 static DEFINE_PER_CPU(struct rcu_data, rcu_data);
+
 static struct rcu_ctrlblk rcu_ctrlblk = {
        .fliplock = __SPIN_LOCK_UNLOCKED(rcu_ctrlblk.fliplock),
        .completed = 0,
@@ -427,10 +471,6 @@ static void __rcu_advance_callbacks(struct rcu_data *rdp)
        }
 }
 
-DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_dyntick_sched, rcu_dyntick_sched) = {
-       .dynticks = 1,
-};
-
 #ifdef CONFIG_NO_HZ
 static DEFINE_PER_CPU(int, rcu_update_flag);