History

rcu/nocb: Use separate flag to indicate disabled ->cblist

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>

Paul E. McKenney committed 7 years ago

Commit 1bb5f9b1 parent 18cd8c94 files · +8 −3Browse files

Unified · Split

4 files
  1. include/linux/rcu_segcblist.h +4 −0
  2. kernel/rcu/rcu_segcblist.c +2 −1
  3. kernel/rcu/rcu_segcblist.h +1 −1
  4. kernel/rcu/tree_plugin.h +1 −1
include/linux/rcu_segcblist.h+4−0
@@ -14,6 +14,9 @@ · 13 unmodified lines
1414 #ifndef __INCLUDE_LINUX_RCU_SEGCBLIST_H
1515 #define __INCLUDE_LINUX_RCU_SEGCBLIST_H
1616
17+#include <linux/types.h>
18+#include <linux/atomic.h>
19+
1720 /* Simple unsegmented callback lists. */
1821 struct rcu_cblist {
1922 struct rcu_head *head;
@@ -67,6 +70,7 @@ struct rcu_segcblist { · 47 unmodified lines
6770 unsigned long gp_seq[RCU_CBLIST_NSEGS];
6871 long len;
6972 long len_lazy;
73+ u8 enabled;
7074 };
7175
7276 #define RCU_SEGCBLIST_INITIALIZER(n) \
kernel/rcu/rcu_segcblist.c+2−1
@@ -58,6 +58,7 @@ void rcu_segcblist_init(struct rcu_segcblist *rsclp) · 57 unmodified lines
5858 rsclp->tails[i] = &rsclp->head;
5959 rsclp->len = 0;
6060 rsclp->len_lazy = 0;
61+ rsclp->enabled = 1;
6162 }
6263
6364 /*
@@ -69,7 +70,7 @@ void rcu_segcblist_disable(struct rcu_segcblist *rsclp) · 5 unmodified lines
6970 WARN_ON_ONCE(!rcu_segcblist_empty(rsclp));
7071 WARN_ON_ONCE(rcu_segcblist_n_cbs(rsclp));
7172 WARN_ON_ONCE(rcu_segcblist_n_lazy_cbs(rsclp));
72− rsclp->tails[RCU_NEXT_TAIL] = NULL;
73+ rsclp->enabled = 0;
7374 }
7475
7576 /*
kernel/rcu/rcu_segcblist.h+1−1
@@ -63,7 +63,7 @@ static inline long rcu_segcblist_n_nonlazy_cbs(struct rcu_segcblist *rsclp) · 62 unmodified lines
6363 */
6464 static inline bool rcu_segcblist_is_enabled(struct rcu_segcblist *rsclp)
6565 {
66− return !!rsclp->tails[RCU_NEXT_TAIL];
66+ return rsclp->enabled;
6767 }
6868
6969 /*
kernel/rcu/tree_plugin.h+1−1
@@ -2189,8 +2189,8 @@ static bool init_nocb_callback_list(struct rcu_data *rdp) · 2188 unmodified lines
21892189 rcu_segcblist_n_cbs(&rdp->cblist));
21902190 atomic_long_set(&rdp->nocb_q_count_lazy,
21912191 rcu_segcblist_n_lazy_cbs(&rdp->cblist));
2192− rcu_segcblist_init(&rdp->cblist);
21932192 }
2193+ rcu_segcblist_init(&rdp->cblist);
21942194 rcu_segcblist_disable(&rdp->cblist);
21952195 return true;
21962196 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t