]> git.baikalelectronics.ru Git - kernel.git/commit
srcu: Use invalid initial value for srcu_node GP sequence numbers
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 27 Jan 2022 01:03:06 +0000 (17:03 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 11 Apr 2022 22:31:03 +0000 (15:31 -0700)
commita0c21e482529bfb234216f589556465c7083c332
tree3ab78411e05c417c91340227f1b22952e0d05569
parent69d1041ba3122fb7fbfcc308ea1aae19188f1374
srcu: Use invalid initial value for srcu_node GP sequence numbers

Currently, tree SRCU relies on the srcu_node structures being initialized
at the same time that the srcu_struct itself is initialized, and thus
use the initial grace-period sequence number as the initial value for
the srcu_node structure's ->srcu_have_cbs[] and ->srcu_gp_seq_needed_exp
fields.  Although this has a high probability of also working when the
srcu_node array is allocated and initialized at some random later time,
it would be better to avoid leaving such things to chance.

This commit therefore initializes these fields with 0x2, which is a
recognizable invalid value.  It then adds the required checks for this
invalid value in order to avoid confusion on long-running kernels
(especially those on 32-bit systems) that allocate and initialize
srcu_node arrays late in life.

Co-developed-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Signed-off-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/srcutree.c