hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/rcutiny.h
....@@ -1,23 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0+ */
12 /*
23 * Read-Copy Update mechanism for mutual exclusion, the Bloatwatch edition.
34 *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, you can access it online at
16
- * http://www.gnu.org/licenses/gpl-2.0.html.
17
- *
185 * Copyright IBM Corporation, 2008
196 *
20
- * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
7
+ * Author: Paul E. McKenney <paulmck@linux.ibm.com>
218 *
229 * For detailed explanation of Read-Copy Update mechanism see -
2310 * Documentation/RCU
....@@ -25,13 +12,7 @@
2512 #ifndef __LINUX_TINY_H
2613 #define __LINUX_TINY_H
2714
28
-#include <linux/ktime.h>
29
-
30
-struct rcu_dynticks;
31
-static inline int rcu_dynticks_snap(struct rcu_dynticks *rdtp)
32
-{
33
- return 0;
34
-}
15
+#include <asm/param.h> /* for HZ */
3516
3617 /* Never flag non-existent other CPUs! */
3718 static inline bool rcu_eqs_special_set(int cpu) { return false; }
....@@ -46,54 +27,45 @@
4627 might_sleep();
4728 }
4829
49
-static inline unsigned long get_state_synchronize_sched(void)
50
-{
51
- return 0;
52
-}
53
-
54
-static inline void cond_synchronize_sched(unsigned long oldstate)
55
-{
56
- might_sleep();
57
-}
58
-
59
-extern void rcu_barrier_bh(void);
60
-extern void rcu_barrier_sched(void);
30
+extern void rcu_barrier(void);
6131
6232 static inline void synchronize_rcu_expedited(void)
6333 {
64
- synchronize_sched(); /* Only one CPU, so pretty fast anyway!!! */
34
+ synchronize_rcu();
6535 }
6636
67
-static inline void rcu_barrier(void)
37
+/*
38
+ * Add one more declaration of kvfree() here. It is
39
+ * not so straight forward to just include <linux/mm.h>
40
+ * where it is defined due to getting many compile
41
+ * errors caused by that include.
42
+ */
43
+extern void kvfree(const void *addr);
44
+
45
+static inline void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
6846 {
69
- rcu_barrier_sched(); /* Only one CPU, so only one list of callbacks! */
47
+ if (head) {
48
+ call_rcu(head, func);
49
+ return;
50
+ }
51
+
52
+ // kvfree_rcu(one_arg) call.
53
+ might_sleep();
54
+ synchronize_rcu();
55
+ kvfree((void *) func);
7056 }
7157
72
-static inline void synchronize_rcu_bh(void)
73
-{
74
- synchronize_sched();
75
-}
58
+void rcu_qs(void);
7659
77
-static inline void synchronize_rcu_bh_expedited(void)
60
+static inline void rcu_softirq_qs(void)
7861 {
79
- synchronize_sched();
80
-}
81
-
82
-static inline void synchronize_sched_expedited(void)
83
-{
84
- synchronize_sched();
85
-}
86
-
87
-static inline void kfree_call_rcu(struct rcu_head *head,
88
- rcu_callback_t func)
89
-{
90
- call_rcu(head, func);
62
+ rcu_qs();
9163 }
9264
9365 #define rcu_note_context_switch(preempt) \
9466 do { \
95
- rcu_sched_qs(); \
96
- rcu_tasks_qs(current); \
67
+ rcu_qs(); \
68
+ rcu_tasks_qs(current, (preempt)); \
9769 } while (0)
9870
9971 static inline int rcu_needs_cpu(u64 basemono, u64 *nextevt)
....@@ -108,20 +80,32 @@
10880 */
10981 static inline void rcu_virt_note_context_switch(int cpu) { }
11082 static inline void rcu_cpu_stall_reset(void) { }
83
+static inline int rcu_jiffies_till_stall_check(void) { return 21 * HZ; }
11184 static inline void rcu_idle_enter(void) { }
11285 static inline void rcu_idle_exit(void) { }
11386 static inline void rcu_irq_enter(void) { }
11487 static inline void rcu_irq_exit_irqson(void) { }
11588 static inline void rcu_irq_enter_irqson(void) { }
11689 static inline void rcu_irq_exit(void) { }
90
+static inline void rcu_irq_exit_preempt(void) { }
91
+static inline void rcu_irq_exit_check_preempt(void) { }
11792 static inline void exit_rcu(void) { }
93
+static inline bool rcu_preempt_need_deferred_qs(struct task_struct *t)
94
+{
95
+ return false;
96
+}
97
+static inline void rcu_preempt_deferred_qs(struct task_struct *t) { }
11898 #ifdef CONFIG_SRCU
11999 void rcu_scheduler_starting(void);
120100 #else /* #ifndef CONFIG_SRCU */
121101 static inline void rcu_scheduler_starting(void) { }
122102 #endif /* #else #ifndef CONFIG_SRCU */
123103 static inline void rcu_end_inkernel_boot(void) { }
104
+static inline bool rcu_inkernel_boot_has_ended(void) { return true; }
124105 static inline bool rcu_is_watching(void) { return true; }
106
+static inline void rcu_momentary_dyntick_idle(void) { }
107
+static inline void kfree_rcu_scheduler_running(void) { }
108
+static inline bool rcu_gp_might_be_stalled(void) { return false; }
125109
126110 /* Avoid RCU read-side critical sections leaking across. */
127111 static inline void rcu_all_qs(void) { barrier(); }