hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/include/linux/srcutree.h
....@@ -1,24 +1,11 @@
1
+/* SPDX-License-Identifier: GPL-2.0+ */
12 /*
23 * Sleepable Read-Copy Update mechanism for mutual exclusion,
34 * tree variant.
45 *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, you can access it online at
17
- * http://www.gnu.org/licenses/gpl-2.0.html.
18
- *
196 * Copyright (C) IBM Corporation, 2017
207 *
21
- * Author: Paul McKenney <paulmck@us.ibm.com>
8
+ * Author: Paul McKenney <paulmck@linux.ibm.com>
229 */
2310
2411 #ifndef _LINUX_SRCU_TREE_H
....@@ -45,13 +32,14 @@
4532 unsigned long srcu_gp_seq_needed; /* Furthest future GP needed. */
4633 unsigned long srcu_gp_seq_needed_exp; /* Furthest future exp GP. */
4734 bool srcu_cblist_invoking; /* Invoking these CBs? */
48
- struct delayed_work work; /* Context for CB invoking. */
35
+ struct timer_list delay_work; /* Delay for CB invoking */
36
+ struct work_struct work; /* Context for CB invoking. */
4937 struct rcu_head srcu_barrier_head; /* For srcu_barrier() use. */
5038 struct srcu_node *mynode; /* Leaf srcu_node. */
5139 unsigned long grpmask; /* Mask for leaf srcu_node */
5240 /* ->srcu_data_have_cbs[]. */
5341 int cpu;
54
- struct srcu_struct *sp;
42
+ struct srcu_struct *ssp;
5543 };
5644
5745 /*
....@@ -105,12 +93,13 @@
10593 #define SRCU_STATE_SCAN2 2
10694
10795 #define __SRCU_STRUCT_INIT(name, pcpu_name) \
108
- { \
109
- .sda = &pcpu_name, \
110
- .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
111
- .srcu_gp_seq_needed = 0 - 1, \
112
- __SRCU_DEP_MAP_INIT(name) \
113
- }
96
+{ \
97
+ .sda = &pcpu_name, \
98
+ .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
99
+ .srcu_gp_seq_needed = -1UL, \
100
+ .work = __DELAYED_WORK_INITIALIZER(name.work, NULL, 0), \
101
+ __SRCU_DEP_MAP_INIT(name) \
102
+}
114103
115104 /*
116105 * Define and initialize a srcu struct at build time.
....@@ -131,14 +120,22 @@
131120 *
132121 * See include/linux/percpu-defs.h for the rules on per-CPU variables.
133122 */
134
-#define __DEFINE_SRCU(name, is_static) \
135
- static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data);\
136
- is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name##_srcu_data)
123
+#ifdef MODULE
124
+# define __DEFINE_SRCU(name, is_static) \
125
+ is_static struct srcu_struct name; \
126
+ struct srcu_struct * const __srcu_struct_##name \
127
+ __section("___srcu_struct_ptrs") = &name
128
+#else
129
+# define __DEFINE_SRCU(name, is_static) \
130
+ static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data); \
131
+ is_static struct srcu_struct name = \
132
+ __SRCU_STRUCT_INIT(name, name##_srcu_data)
133
+#endif
137134 #define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */)
138135 #define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static)
139136
140
-void synchronize_srcu_expedited(struct srcu_struct *sp);
141
-void srcu_barrier(struct srcu_struct *sp);
142
-void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf);
137
+void synchronize_srcu_expedited(struct srcu_struct *ssp);
138
+void srcu_barrier(struct srcu_struct *ssp);
139
+void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf);
143140
144141 #endif