With the previous patch, srcu_cb_mutex is held when setting SRCU_SIZE_WAIT_BARRIER. It means that only two seq snap value can exist. And these two snaps can not see the active snp tree if srcu_gp_start_if_needed() fetches the srcu_size_state before it is updated to SRCU_SIZE_WAIT_BARRIER. After dispatching these two snap value's callbacks, the mask in snp->srcu_data_have_cbs[idx] is assured to be right. Hence the size state following SRCU_SIZE_WAIT_BARRIER can be shrink to three. Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx> Cc: Lai Jiangshan <jiangshanlai@xxxxxxxxx> Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxx> Cc: Frederic Weisbecker <frederic@xxxxxxxxxx> Cc: Josh Triplett <josh@xxxxxxxxxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> Cc: "Zhang, Qiang1" <qiang1.zhang@xxxxxxxxx> To: rcu@xxxxxxxxxxxxxxx --- include/linux/srcutree.h | 15 +++++++++------ kernel/rcu/srcutree.c | 3 --- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index e3014319d1ad..34cb9435c14d 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -94,13 +94,16 @@ struct srcu_struct { /* Values for size state variable (->srcu_size_state). */ #define SRCU_SIZE_SMALL 0 #define SRCU_SIZE_ALLOC 1 +/* If snp tree is initialized */ #define SRCU_SIZE_WAIT_BARRIER 2 -#define SRCU_SIZE_WAIT_CALL 3 -#define SRCU_SIZE_WAIT_CBS1 4 -#define SRCU_SIZE_WAIT_CBS2 5 -#define SRCU_SIZE_WAIT_CBS3 6 -#define SRCU_SIZE_WAIT_CBS4 7 -#define SRCU_SIZE_BIG 8 +/* + * The following two states for the in-flight seq snap, who may not see + * the snp tree is active. + */ +#define SRCU_SIZE_WAIT_CBS1 3 +#define SRCU_SIZE_WAIT_CBS2 4 +/* All seq snap see the active tree */ +#define SRCU_SIZE_BIG 5 /* Values for state variable (bottom bits of ->srcu_gp_seq). */ #define SRCU_STATE_IDLE 0 diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 281cd69fe804..bdf392e2ef63 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -1652,11 +1652,8 @@ static const char * const srcu_size_state_name[] = { "SRCU_SIZE_SMALL", "SRCU_SIZE_ALLOC", "SRCU_SIZE_WAIT_BARRIER", - "SRCU_SIZE_WAIT_CALL", "SRCU_SIZE_WAIT_CBS1", "SRCU_SIZE_WAIT_CBS2", - "SRCU_SIZE_WAIT_CBS3", - "SRCU_SIZE_WAIT_CBS4", "SRCU_SIZE_BIG", "SRCU_SIZE_???", }; -- 2.31.1