WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] rcu: move private declarations and definitions from

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] rcu: move private declarations and definitions from header to implementation
From: "Jan Beulich" <JBeulich@xxxxxxxx>
Date: Fri, 14 Oct 2011 08:50:24 +0100
Delivery-date: Fri, 14 Oct 2011 00:51:18 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
No consumer of RCU should need to see these, and there's also no need
to clutter the global name space with them.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/common/rcupdate.c
+++ b/xen/common/rcupdate.c
@@ -46,15 +46,50 @@
 #include <xen/cpu.h>
 #include <xen/stop_machine.h>
 
-/* Definition for rcupdate control block. */
-struct rcu_ctrlblk rcu_ctrlblk = {
+/* Global control variables for rcupdate callback mechanism. */
+static struct rcu_ctrlblk {
+    long cur;           /* Current batch number.                      */
+    long completed;     /* Number of the last completed batch         */
+    int  next_pending;  /* Is the next batch already waiting?         */
+
+    spinlock_t  lock __cacheline_aligned;
+    cpumask_t   cpumask; /* CPUs that need to switch in order    */
+    /* for current batch to proceed.        */
+} __cacheline_aligned rcu_ctrlblk = {
     .cur = -300,
     .completed = -300,
     .lock = SPIN_LOCK_UNLOCKED,
     .cpumask = CPU_MASK_NONE,
 };
 
-DEFINE_PER_CPU(struct rcu_data, rcu_data);
+/*
+ * Per-CPU data for Read-Copy Update.
+ * nxtlist - new callbacks are added here
+ * curlist - current batch for which quiescent cycle started if any
+ */
+struct rcu_data {
+    /* 1) quiescent state handling : */
+    long quiescbatch;    /* Batch # for grace period */
+    int  qs_pending;     /* core waits for quiesc state */
+
+    /* 2) batch handling */
+    long            batch;            /* Batch # for current RCU batch */
+    struct rcu_head *nxtlist;
+    struct rcu_head **nxttail;
+    long            qlen;             /* # of queued callbacks */
+    struct rcu_head *curlist;
+    struct rcu_head **curtail;
+    struct rcu_head *donelist;
+    struct rcu_head **donetail;
+    long            blimit;           /* Upper limit on a processed batch */
+    int cpu;
+    struct rcu_head barrier;
+#ifdef CONFIG_SMP
+    long            last_rs_qlen;     /* qlen during the last resched */
+#endif
+};
+
+static DEFINE_PER_CPU(struct rcu_data, rcu_data);
 
 static int blimit = 10;
 static int qhimark = 10000;
@@ -104,6 +139,18 @@ int rcu_barrier(void)
     return stop_machine_run(rcu_barrier_action, &cpu_count, NR_CPUS);
 }
 
+/* Is batch a before batch b ? */
+static inline int rcu_batch_before(long a, long b)
+{
+    return (a - b) < 0;
+}
+
+/* Is batch a after batch b ? */
+static inline int rcu_batch_after(long a, long b)
+{
+    return (a - b) > 0;
+}
+
 static void force_quiescent_state(struct rcu_data *rdp,
                                   struct rcu_ctrlblk *rcp)
 {
--- a/xen/include/xen/rcupdate.h
+++ b/xen/include/xen/rcupdate.h
@@ -57,60 +57,6 @@ struct rcu_head {
 } while (0)
 
 
-
-/* Global control variables for rcupdate callback mechanism. */
-struct rcu_ctrlblk {
-    long cur;           /* Current batch number.                      */
-    long completed;     /* Number of the last completed batch         */
-    int  next_pending;  /* Is the next batch already waiting?         */
-
-    spinlock_t  lock __cacheline_aligned;
-    cpumask_t   cpumask; /* CPUs that need to switch in order    */
-    /* for current batch to proceed.        */
-} __cacheline_aligned;
-
-/* Is batch a before batch b ? */
-static inline int rcu_batch_before(long a, long b)
-{
-    return (a - b) < 0;
-}
-
-/* Is batch a after batch b ? */
-static inline int rcu_batch_after(long a, long b)
-{
-    return (a - b) > 0;
-}
-
-/*
- * Per-CPU data for Read-Copy Update.
- * nxtlist - new callbacks are added here
- * curlist - current batch for which quiescent cycle started if any
- */
-struct rcu_data {
-    /* 1) quiescent state handling : */
-    long quiescbatch;    /* Batch # for grace period */
-    int  qs_pending;     /* core waits for quiesc state */
-
-    /* 2) batch handling */
-    long            batch;            /* Batch # for current RCU batch */
-    struct rcu_head *nxtlist;
-    struct rcu_head **nxttail;
-    long            qlen;             /* # of queued callbacks */
-    struct rcu_head *curlist;
-    struct rcu_head **curtail;
-    struct rcu_head *donelist;
-    struct rcu_head **donetail;
-    long            blimit;           /* Upper limit on a processed batch */
-    int cpu;
-    struct rcu_head barrier;
-#ifdef CONFIG_SMP
-    long            last_rs_qlen;     /* qlen during the last resched */
-#endif
-};
-
-DECLARE_PER_CPU(struct rcu_data, rcu_data);
-extern struct rcu_ctrlblk rcu_ctrlblk;
-
 int rcu_pending(int cpu);
 int rcu_needs_cpu(int cpu);
 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>