diff options
author | Richard Braun <rbraun@sceen.net> | 2018-02-21 20:36:13 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-02-21 20:36:13 +0100 |
commit | a71d1c596da77146ddf8d54e9632d123b5cc8568 (patch) | |
tree | 9d9236c0551cbf49901f9fe0b59b381b928014f5 | |
parent | 06a4fe8a688a489fe24e5d215a5af95d82a1fb27 (diff) |
kern/rcu: comment the loop in rcu_cpu_data_check_gp_state
-rw-r--r-- | kern/rcu.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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); |