Skip to content

Commit 0126574

Browse files
bvanasscheIngo Molnar
authored andcommitted
locking/lockdep: Only call init_rcu_head() after RCU has been initialized
init_data_structures_once() is called for the first time before RCU has been initialized. Make sure that init_rcu_head() is called before the RCU head is used and after RCU has been initialized. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@surriel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Deacon <will.deacon@arm.com> Cc: longman@redhat.com Link: https://lkml.kernel.org/r/c20aa0f0-42ab-a884-d931-7d4ec2bf0cdc@acm.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 3fe7522 commit 0126574

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

kernel/locking/lockdep.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -982,15 +982,22 @@ static inline void check_data_structures(void) { }
982982
*/
983983
static void init_data_structures_once(void)
984984
{
985-
static bool initialization_happened;
985+
static bool ds_initialized, rcu_head_initialized;
986986
int i;
987987

988-
if (likely(initialization_happened))
988+
if (likely(rcu_head_initialized))
989989
return;
990990

991-
initialization_happened = true;
991+
if (system_state >= SYSTEM_SCHEDULING) {
992+
init_rcu_head(&delayed_free.rcu_head);
993+
rcu_head_initialized = true;
994+
}
995+
996+
if (ds_initialized)
997+
return;
998+
999+
ds_initialized = true;
9921000

993-
init_rcu_head(&delayed_free.rcu_head);
9941001
INIT_LIST_HEAD(&delayed_free.pf[0].zapped);
9951002
INIT_LIST_HEAD(&delayed_free.pf[1].zapped);
9961003

0 commit comments

Comments
 (0)