aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/rcupdate.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2011-10-14 10:16:39 +0200
committerJan Beulich <jbeulich@suse.com>2011-10-14 10:16:39 +0200
commitdd2fa8c3b5086cb36ac4cce3dec8bc7b92c10ec0 (patch)
tree2c2140092fda7c955dbae140451f13218cdef8fc /xen/common/rcupdate.c
parent52776ac43ce4ad58ce104ca8426b1ee03622d61b (diff)
downloadxen-dd2fa8c3b5086cb36ac4cce3dec8bc7b92c10ec0.tar.gz
xen-dd2fa8c3b5086cb36ac4cce3dec8bc7b92c10ec0.tar.bz2
xen-dd2fa8c3b5086cb36ac4cce3dec8bc7b92c10ec0.zip
rcu: move private declarations and definitions from header to implementation
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@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/rcupdate.c')
-rw-r--r--xen/common/rcupdate.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/xen/common/rcupdate.c b/xen/common/rcupdate.c
index 973da06f2e..9911f92e2e 100644
--- 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)
{