summaryrefslogtreecommitdiff
path: root/kern/rcu.c
diff options
context:
space:
mode:
Diffstat (limited to 'kern/rcu.c')
-rw-r--r--kern/rcu.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/kern/rcu.c b/kern/rcu.c
index 34ebc0ff..973d6d50 100644
--- a/kern/rcu.c
+++ b/kern/rcu.c
@@ -638,7 +638,13 @@ rcu_cpu_data_check_gp_state(struct rcu_cpu_data *cpu_data)
data = &rcu_data;
- for (;;) {
+ /*
+ * A loop is used to optimize the case where a processor is the last to
+ * acknowledge a grace period state change, in which case the latter
+ * also immediately changes and can be acknowleged right away. As a
+ * result, this loop may never run more than twice.
+ */
+ for (unsigned int i = 0; /* no condition */; i++) {
local_gp_state = cpu_data->gp_state;
diff = rcu_data_check_gp_state(data, local_gp_state, &global_gp_state);
@@ -646,6 +652,8 @@ rcu_cpu_data_check_gp_state(struct rcu_cpu_data *cpu_data)
break;
}
+ assert(i < 2);
+
switch (global_gp_state) {
case RCU_GP_STATE_WORK_WINDOW_FLIP:
rcu_cpu_data_flip_work_wid(cpu_data);