summaryrefslogtreecommitdiffstats
path: root/kernel/rcu/rcu.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2018-05-16 00:24:41 +0200
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2018-07-13 00:38:55 +0200
commitd72193123c81ae6123d108b3be2096f3f13b25a6 (patch)
tree2ec9801c5c3b7c1f9411ba3a1bc6005d1f154198 /kernel/rcu/rcu.h
parentrcu: Make rcu_start_this_gp() check for grace period already started (diff)
downloadlinux-d72193123c81ae6123d108b3be2096f3f13b25a6.tar.xz
linux-d72193123c81ae6123d108b3be2096f3f13b25a6.zip
rcutorture: Correctly handle grace-period sequence wrap
The new ->gq_seq grace-period sequence numbers must be shifted down, which give artifacts when these numbers wrap. This commit therefore enables rcutorture and rcuperf to handle grace-period sequence numbers even if they do wrap. It does this by allowing a special subtraction function to be specified, and this function subtracts before shifting. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu/rcu.h')
-rw-r--r--kernel/rcu/rcu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index 1c5cbd9d7c97..aa215d6355f8 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -143,6 +143,15 @@ static inline bool rcu_seq_new_gp(unsigned long old, unsigned long new)
}
/*
+ * Roughly how many full grace periods have elapsed between the collection
+ * of the two specified grace periods?
+ */
+static inline unsigned long rcu_seq_diff(unsigned long new, unsigned long old)
+{
+ return (new - old) >> RCU_SEQ_CTR_SHIFT;
+}
+
+/*
* debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally
* by call_rcu() and rcu callback execution, and are therefore not part of the
* RCU API. Leaving in rcupdate.h because they are used by all RCU flavors.