@@ -221,18 +221,17 @@ do { \
221
221
#endif
222
222
223
223
/**
224
- * smp_cond_load_acquire () - (Spin) wait for cond with ACQUIRE ordering
224
+ * smp_cond_load_relaxed () - (Spin) wait for cond with no ordering guarantees
225
225
* @ptr: pointer to the variable to wait on
226
226
* @cond: boolean expression to wait for
227
227
*
228
- * Equivalent to using smp_load_acquire() on the condition variable but employs
229
- * the control dependency of the wait to reduce the barrier on many platforms.
228
+ * Equivalent to using READ_ONCE() on the condition variable.
230
229
*
231
230
* Due to C lacking lambda expressions we load the value of *ptr into a
232
231
* pre-named variable @VAL to be used in @cond.
233
232
*/
234
- #ifndef smp_cond_load_acquire
235
- #define smp_cond_load_acquire (ptr , cond_expr ) ({ \
233
+ #ifndef smp_cond_load_relaxed
234
+ #define smp_cond_load_relaxed (ptr , cond_expr ) ({ \
236
235
typeof(ptr) __PTR = (ptr); \
237
236
typeof(*ptr) VAL; \
238
237
for (;;) { \
@@ -241,10 +240,26 @@ do { \
241
240
break; \
242
241
cpu_relax(); \
243
242
} \
244
- smp_acquire__after_ctrl_dep(); \
245
243
VAL; \
246
244
})
247
245
#endif
248
246
247
+ /**
248
+ * smp_cond_load_acquire() - (Spin) wait for cond with ACQUIRE ordering
249
+ * @ptr: pointer to the variable to wait on
250
+ * @cond: boolean expression to wait for
251
+ *
252
+ * Equivalent to using smp_load_acquire() on the condition variable but employs
253
+ * the control dependency of the wait to reduce the barrier on many platforms.
254
+ */
255
+ #ifndef smp_cond_load_acquire
256
+ #define smp_cond_load_acquire (ptr , cond_expr ) ({ \
257
+ typeof(*ptr) _val; \
258
+ _val = smp_cond_load_relaxed(ptr, cond_expr); \
259
+ smp_acquire__after_ctrl_dep(); \
260
+ _val; \
261
+ })
262
+ #endif
263
+
249
264
#endif /* !__ASSEMBLY__ */
250
265
#endif /* __ASM_GENERIC_BARRIER_H */
0 commit comments