NULLing the RCU_NEXT_TAIL pointer was a clever way to save a byte, but forward-progress considerations would require that this pointer be both NULL and non-NULL, which, absent a quantum-computer port of the Linux kernel, simply won't happen. This commit therefore creates as separate ->enabled flag to replace the current NULL checks. [ paulmck: Add include files per 0day test robot and -next. ] Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Unified · Split
| @@ -14,6 +14,9 @@ · 13 unmodified lines | ||
| 14 | 14 | #ifndef __INCLUDE_LINUX_RCU_SEGCBLIST_H |
| 15 | 15 | #define __INCLUDE_LINUX_RCU_SEGCBLIST_H |
| 16 | 16 | |
| 17 | +#include <linux/types.h> | |
| 18 | +#include <linux/atomic.h> | |
| 19 | + | |
| 17 | 20 | /* Simple unsegmented callback lists. */ |
| 18 | 21 | struct rcu_cblist { |
| 19 | 22 | struct rcu_head *head; |
| @@ -67,6 +70,7 @@ struct rcu_segcblist { · 47 unmodified lines | ||
| 67 | 70 | unsigned long gp_seq[RCU_CBLIST_NSEGS]; |
| 68 | 71 | long len; |
| 69 | 72 | long len_lazy; |
| 73 | + u8 enabled; | |
| 70 | 74 | }; |
| 71 | 75 | |
| 72 | 76 | #define RCU_SEGCBLIST_INITIALIZER(n) \ |
| @@ -58,6 +58,7 @@ void rcu_segcblist_init(struct rcu_segcblist *rsclp) · 57 unmodified lines | ||
| 58 | 58 | rsclp->tails[i] = &rsclp->head; |
| 59 | 59 | rsclp->len = 0; |
| 60 | 60 | rsclp->len_lazy = 0; |
| 61 | + rsclp->enabled = 1; | |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | /* |
| @@ -69,7 +70,7 @@ void rcu_segcblist_disable(struct rcu_segcblist *rsclp) · 5 unmodified lines | ||
| 69 | 70 | WARN_ON_ONCE(!rcu_segcblist_empty(rsclp)); |
| 70 | 71 | WARN_ON_ONCE(rcu_segcblist_n_cbs(rsclp)); |
| 71 | 72 | WARN_ON_ONCE(rcu_segcblist_n_lazy_cbs(rsclp)); |
| 72 | − rsclp->tails[RCU_NEXT_TAIL] = NULL; | |
| 73 | + rsclp->enabled = 0; | |
| 73 | 74 | } |
| 74 | 75 | |
| 75 | 76 | /* |
| @@ -63,7 +63,7 @@ static inline long rcu_segcblist_n_nonlazy_cbs(struct rcu_segcblist *rsclp) · 62 unmodified lines | ||
| 63 | 63 | */ |
| 64 | 64 | static inline bool rcu_segcblist_is_enabled(struct rcu_segcblist *rsclp) |
| 65 | 65 | { |
| 66 | − return !!rsclp->tails[RCU_NEXT_TAIL]; | |
| 66 | + return rsclp->enabled; | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /* |
| @@ -2189,8 +2189,8 @@ static bool init_nocb_callback_list(struct rcu_data *rdp) · 2188 unmodified lines | ||
| 2189 | 2189 | rcu_segcblist_n_cbs(&rdp->cblist)); |
| 2190 | 2190 | atomic_long_set(&rdp->nocb_q_count_lazy, |
| 2191 | 2191 | rcu_segcblist_n_lazy_cbs(&rdp->cblist)); |
| 2192 | − rcu_segcblist_init(&rdp->cblist); | |
| 2193 | 2192 | } |
| 2193 | + rcu_segcblist_init(&rdp->cblist); | |
| 2194 | 2194 | rcu_segcblist_disable(&rdp->cblist); |
| 2195 | 2195 | return true; |
| 2196 | 2196 | } |