hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/u64_stats_sync.h
....@@ -66,7 +66,7 @@
6666 #include <linux/seqlock.h>
6767
6868 struct u64_stats_sync {
69
-#if BITS_PER_LONG==32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT))
69
+#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
7070 seqcount_t seq;
7171 #endif
7272 };
....@@ -115,7 +115,7 @@
115115 }
116116 #endif
117117
118
-#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT))
118
+#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
119119 #define u64_stats_init(syncp) seqcount_init(&(syncp)->seq)
120120 #else
121121 static inline void u64_stats_init(struct u64_stats_sync *syncp)
....@@ -125,19 +125,15 @@
125125
126126 static inline void u64_stats_update_begin(struct u64_stats_sync *syncp)
127127 {
128
-#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT))
129
- if (IS_ENABLED(CONFIG_PREEMPT_RT))
130
- preempt_disable();
128
+#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
131129 write_seqcount_begin(&syncp->seq);
132130 #endif
133131 }
134132
135133 static inline void u64_stats_update_end(struct u64_stats_sync *syncp)
136134 {
137
-#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT))
135
+#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
138136 write_seqcount_end(&syncp->seq);
139
- if (IS_ENABLED(CONFIG_PREEMPT_RT))
140
- preempt_enable();
141137 #endif
142138 }
143139
....@@ -146,11 +142,8 @@
146142 {
147143 unsigned long flags = 0;
148144
149
-#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT))
150
- if (IS_ENABLED(CONFIG_PREEMPT_RT))
151
- preempt_disable();
152
- else
153
- local_irq_save(flags);
145
+#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
146
+ local_irq_save(flags);
154147 write_seqcount_begin(&syncp->seq);
155148 #endif
156149 return flags;
....@@ -160,18 +153,15 @@
160153 u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp,
161154 unsigned long flags)
162155 {
163
-#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT))
156
+#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
164157 write_seqcount_end(&syncp->seq);
165
- if (IS_ENABLED(CONFIG_PREEMPT_RT))
166
- preempt_enable();
167
- else
168
- local_irq_restore(flags);
158
+ local_irq_restore(flags);
169159 #endif
170160 }
171161
172162 static inline unsigned int __u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
173163 {
174
-#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT))
164
+#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
175165 return read_seqcount_begin(&syncp->seq);
176166 #else
177167 return 0;
....@@ -180,7 +170,7 @@
180170
181171 static inline unsigned int u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
182172 {
183
-#if BITS_PER_LONG == 32 && (!defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_RT))
173
+#if BITS_PER_LONG==32 && !defined(CONFIG_SMP)
184174 preempt_disable();
185175 #endif
186176 return __u64_stats_fetch_begin(syncp);
....@@ -189,7 +179,7 @@
189179 static inline bool __u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
190180 unsigned int start)
191181 {
192
-#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT))
182
+#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
193183 return read_seqcount_retry(&syncp->seq, start);
194184 #else
195185 return false;
....@@ -199,7 +189,7 @@
199189 static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
200190 unsigned int start)
201191 {
202
-#if BITS_PER_LONG == 32 && (!defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_RT))
192
+#if BITS_PER_LONG==32 && !defined(CONFIG_SMP)
203193 preempt_enable();
204194 #endif
205195 return __u64_stats_fetch_retry(syncp, start);
....@@ -213,9 +203,7 @@
213203 */
214204 static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp)
215205 {
216
-#if BITS_PER_LONG == 32 && defined(CONFIG_PREEMPT_RT)
217
- preempt_disable();
218
-#elif BITS_PER_LONG == 32 && !defined(CONFIG_SMP)
206
+#if BITS_PER_LONG==32 && !defined(CONFIG_SMP)
219207 local_irq_disable();
220208 #endif
221209 return __u64_stats_fetch_begin(syncp);
....@@ -224,9 +212,7 @@
224212 static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp,
225213 unsigned int start)
226214 {
227
-#if BITS_PER_LONG == 32 && defined(CONFIG_PREEMPT_RT)
228
- preempt_enable();
229
-#elif BITS_PER_LONG == 32 && !defined(CONFIG_SMP)
215
+#if BITS_PER_LONG==32 && !defined(CONFIG_SMP)
230216 local_irq_enable();
231217 #endif
232218 return __u64_stats_fetch_retry(syncp, start);