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>
This commit is contained in:
@@ -14,6 +14,9 @@
|
|||||||
#ifndef __INCLUDE_LINUX_RCU_SEGCBLIST_H
|
#ifndef __INCLUDE_LINUX_RCU_SEGCBLIST_H
|
||||||
#define __INCLUDE_LINUX_RCU_SEGCBLIST_H
|
#define __INCLUDE_LINUX_RCU_SEGCBLIST_H
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/atomic.h>
|
||||||
|
|
||||||
/* Simple unsegmented callback lists. */
|
/* Simple unsegmented callback lists. */
|
||||||
struct rcu_cblist {
|
struct rcu_cblist {
|
||||||
struct rcu_head *head;
|
struct rcu_head *head;
|
||||||
@@ -67,6 +70,7 @@ struct rcu_segcblist {
|
|||||||
unsigned long gp_seq[RCU_CBLIST_NSEGS];
|
unsigned long gp_seq[RCU_CBLIST_NSEGS];
|
||||||
long len;
|
long len;
|
||||||
long len_lazy;
|
long len_lazy;
|
||||||
|
u8 enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RCU_SEGCBLIST_INITIALIZER(n) \
|
#define RCU_SEGCBLIST_INITIALIZER(n) \
|
||||||
|
@@ -58,6 +58,7 @@ void rcu_segcblist_init(struct rcu_segcblist *rsclp)
|
|||||||
rsclp->tails[i] = &rsclp->head;
|
rsclp->tails[i] = &rsclp->head;
|
||||||
rsclp->len = 0;
|
rsclp->len = 0;
|
||||||
rsclp->len_lazy = 0;
|
rsclp->len_lazy = 0;
|
||||||
|
rsclp->enabled = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -69,7 +70,7 @@ void rcu_segcblist_disable(struct rcu_segcblist *rsclp)
|
|||||||
WARN_ON_ONCE(!rcu_segcblist_empty(rsclp));
|
WARN_ON_ONCE(!rcu_segcblist_empty(rsclp));
|
||||||
WARN_ON_ONCE(rcu_segcblist_n_cbs(rsclp));
|
WARN_ON_ONCE(rcu_segcblist_n_cbs(rsclp));
|
||||||
WARN_ON_ONCE(rcu_segcblist_n_lazy_cbs(rsclp));
|
WARN_ON_ONCE(rcu_segcblist_n_lazy_cbs(rsclp));
|
||||||
rsclp->tails[RCU_NEXT_TAIL] = NULL;
|
rsclp->enabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -63,7 +63,7 @@ static inline long rcu_segcblist_n_nonlazy_cbs(struct rcu_segcblist *rsclp)
|
|||||||
*/
|
*/
|
||||||
static inline bool rcu_segcblist_is_enabled(struct rcu_segcblist *rsclp)
|
static inline bool rcu_segcblist_is_enabled(struct rcu_segcblist *rsclp)
|
||||||
{
|
{
|
||||||
return !!rsclp->tails[RCU_NEXT_TAIL];
|
return rsclp->enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -2189,8 +2189,8 @@ static bool init_nocb_callback_list(struct rcu_data *rdp)
|
|||||||
rcu_segcblist_n_cbs(&rdp->cblist));
|
rcu_segcblist_n_cbs(&rdp->cblist));
|
||||||
atomic_long_set(&rdp->nocb_q_count_lazy,
|
atomic_long_set(&rdp->nocb_q_count_lazy,
|
||||||
rcu_segcblist_n_lazy_cbs(&rdp->cblist));
|
rcu_segcblist_n_lazy_cbs(&rdp->cblist));
|
||||||
rcu_segcblist_init(&rdp->cblist);
|
|
||||||
}
|
}
|
||||||
|
rcu_segcblist_init(&rdp->cblist);
|
||||||
rcu_segcblist_disable(&rdp->cblist);
|
rcu_segcblist_disable(&rdp->cblist);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user