.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Sleepable Read-Copy Update mechanism for mutual exclusion, |
---|
3 | 4 | * tree variant. |
---|
4 | 5 | * |
---|
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 | | - * |
---|
19 | 6 | * Copyright (C) IBM Corporation, 2017 |
---|
20 | 7 | * |
---|
21 | | - * Author: Paul McKenney <paulmck@us.ibm.com> |
---|
| 8 | + * Author: Paul McKenney <paulmck@linux.ibm.com> |
---|
22 | 9 | */ |
---|
23 | 10 | |
---|
24 | 11 | #ifndef _LINUX_SRCU_TREE_H |
---|
.. | .. |
---|
45 | 32 | unsigned long srcu_gp_seq_needed; /* Furthest future GP needed. */ |
---|
46 | 33 | unsigned long srcu_gp_seq_needed_exp; /* Furthest future exp GP. */ |
---|
47 | 34 | 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. */ |
---|
49 | 37 | struct rcu_head srcu_barrier_head; /* For srcu_barrier() use. */ |
---|
50 | 38 | struct srcu_node *mynode; /* Leaf srcu_node. */ |
---|
51 | 39 | unsigned long grpmask; /* Mask for leaf srcu_node */ |
---|
52 | 40 | /* ->srcu_data_have_cbs[]. */ |
---|
53 | 41 | int cpu; |
---|
54 | | - struct srcu_struct *sp; |
---|
| 42 | + struct srcu_struct *ssp; |
---|
55 | 43 | }; |
---|
56 | 44 | |
---|
57 | 45 | /* |
---|
.. | .. |
---|
105 | 93 | #define SRCU_STATE_SCAN2 2 |
---|
106 | 94 | |
---|
107 | 95 | #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 | +} |
---|
114 | 103 | |
---|
115 | 104 | /* |
---|
116 | 105 | * Define and initialize a srcu struct at build time. |
---|
.. | .. |
---|
131 | 120 | * |
---|
132 | 121 | * See include/linux/percpu-defs.h for the rules on per-CPU variables. |
---|
133 | 122 | */ |
---|
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 |
---|
137 | 134 | #define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */) |
---|
138 | 135 | #define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static) |
---|
139 | 136 | |
---|
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); |
---|
143 | 140 | |
---|
144 | 141 | #endif |
---|