blob: f0a01b2a30623e70cc8e05d112b29c521b0db435 [file] [log] [blame]
Paul E. McKenneybbad9372010-04-02 16:17:17 -07001/*
Paul E. McKenneya57eb942010-06-29 16:49:16 -07002 * Read-Copy Update mechanism for mutual exclusion, the Bloatwatch edition
Paul E. McKenneybbad9372010-04-02 16:17:17 -07003 * Internal non-public definitions that provide either classic
Paul E. McKenneya57eb942010-06-29 16:49:16 -07004 * or preemptible semantics.
Paul E. McKenneybbad9372010-04-02 16:17:17 -07005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
Paul E. McKenney87de1cf2013-12-03 10:02:52 -080017 * along with this program; if not, you can access it online at
18 * http://www.gnu.org/licenses/gpl-2.0.html.
Paul E. McKenneybbad9372010-04-02 16:17:17 -070019 *
Paul E. McKenneya57eb942010-06-29 16:49:16 -070020 * Copyright (c) 2010 Linaro
Paul E. McKenneybbad9372010-04-02 16:17:17 -070021 *
22 * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
23 */
24
Paul E. McKenney900b1022017-02-10 14:32:54 -080025#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SRCU)
Paul E. McKenney318bdcd2013-03-27 10:43:02 -070026#include <linux/kernel_stat.h>
27
Paul E. McKenney24278d12010-09-27 17:25:23 -070028int rcu_scheduler_active __read_mostly;
29EXPORT_SYMBOL_GPL(rcu_scheduler_active);
Paul E. McKenneybbad9372010-04-02 16:17:17 -070030
31/*
32 * During boot, we forgive RCU lockdep issues. After this function is
Paul E. McKenney52d7e482017-01-10 02:28:26 -080033 * invoked, we start taking RCU lockdep issues seriously. Note that unlike
34 * Tree RCU, Tiny RCU transitions directly from RCU_SCHEDULER_INACTIVE
35 * to RCU_SCHEDULER_RUNNING, skipping the RCU_SCHEDULER_INIT stage.
36 * The reason for this is that Tiny RCU does not need kthreads, so does
37 * not have to care about the fact that the scheduler is half-initialized
Paul E. McKenney900b1022017-02-10 14:32:54 -080038 * at a certain phase of the boot process. Unless SRCU is in the mix.
Paul E. McKenneybbad9372010-04-02 16:17:17 -070039 */
Paul E. McKenneyb2c07102010-09-09 13:40:39 -070040void __init rcu_scheduler_starting(void)
Paul E. McKenneybbad9372010-04-02 16:17:17 -070041{
42 WARN_ON(nr_context_switches() > 0);
Paul E. McKenney900b1022017-02-10 14:32:54 -080043 rcu_scheduler_active = IS_ENABLED(CONFIG_SRCU)
44 ? RCU_SCHEDULER_INIT : RCU_SCHEDULER_RUNNING;
Paul E. McKenneybbad9372010-04-02 16:17:17 -070045}
46
Paul E. McKenney900b1022017-02-10 14:32:54 -080047#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SRCU) */