This commit adds to the poll_state_synchronize_srcu() header comment describing the issues surrounding SRCU cookie overflow/wrap for the different kernel configurations.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -1058,6 +1058,21 @@ EXPORT_SYMBOL_GPL(start_poll_synchronize_srcu); · 1057 unmodified lines | |||
| 1058 | * get_state_synchronize_srcu() or start_poll_synchronize_srcu(), and | 1058 | * get_state_synchronize_srcu() or start_poll_synchronize_srcu(), and |
| 1059 | * returns @true if an SRCU grace period elapsed since the time that the | 1059 | * returns @true if an SRCU grace period elapsed since the time that the |
| 1060 | * cookie was created. | 1060 | * cookie was created. |
| 1061 | * | ||
| 1062 | * Because cookies are finite in size, wrapping/overflow is possible. | ||
| 1063 | * This is more pronounced on 32-bit systems where cookies are 32 bits, | ||
| 1064 | * where in theory wrapping could happen in about 14 hours assuming | ||
| 1065 | * 25-microsecond expedited SRCU grace periods. However, a more likely | ||
| 1066 | * overflow lower bound is on the order of 24 days in the case of | ||
| 1067 | * one-millisecond SRCU grace periods. Of course, wrapping in a 64-bit | ||
| 1068 | * system requires geologic timespans, as in more than seven million years | ||
| 1069 | * even for expedited SRCU grace periods. | ||
| 1070 | * | ||
| 1071 | * Wrapping/overflow is much more of an issue for CONFIG_SMP=n systems | ||
| 1072 | * that also have CONFIG_PREEMPTION=n, which selects Tiny SRCU. This uses | ||
| 1073 | * a 16-bit cookie, which rcutorture routinely wraps in a matter of a | ||
| 1074 | * few minutes. If this proves to be a problem, this counter will be | ||
| 1075 | * expanded to the same size as for Tree SRCU. | ||
| 1061 | */ | 1076 | */ |
| 1062 | bool poll_state_synchronize_srcu(struct srcu_struct *ssp, unsigned long cookie) | 1077 | bool poll_state_synchronize_srcu(struct srcu_struct *ssp, unsigned long cookie) |
| 1063 | { | 1078 | { |