Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking/atomic: scripts: Clarify ordering of conditional atomics

Conditional atomic operations (e.g. cmpxchg()) only provide ordering
when the condition holds; when the condition does not hold, the location
is not modified and relaxed ordering is provided. Where ordering is
needed for failed conditional atomics, it is necessary to use
smp_mb__before_atomic() and/or smp_mb__after_atomic().

This is explained tersely in memory-barriers.txt, and is implied but not
explicitly stated in the kerneldoc comments for the conditional
operations. The lack of an explicit statement has lead to some off-list
queries about the ordering semantics of failing conditional operations,
so evidently this is confusing.

Update the kerneldoc comments to explicitly describe the lack of ordering
for failed conditional atomic operations.

For most conditional atomic operations, this is written as:

| If (${condition}), atomically updates @v to (${new}) with ${desc_order} ordering.
| Otherwise, @v is not modified and relaxed ordering is provided.

For the try_cmpxchg() operations, this is written as:

| If (${condition}), atomically updates @v to @new with ${desc_order} ordering.
| Otherwise, @v is not modified, @old is updated to the current value of @v,
| and relaxed ordering is provided.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Link: https://lore.kernel.org/r/20240209124010.2096198-1-mark.rutland@arm.com

authored by

Mark Rutland and committed by
Ingo Molnar
6dfee110 b401b621

+119 -28
+37 -9
include/linux/atomic/atomic-arch-fallback.h
··· 2005 2005 * @new: int value to assign 2006 2006 * 2007 2007 * If (@v == @old), atomically updates @v to @new with full ordering. 2008 + * Otherwise, @v is not modified and relaxed ordering is provided. 2008 2009 * 2009 2010 * Safe to use in noinstr code; prefer atomic_cmpxchg() elsewhere. 2010 2011 * ··· 2034 2033 * @new: int value to assign 2035 2034 * 2036 2035 * If (@v == @old), atomically updates @v to @new with acquire ordering. 2036 + * Otherwise, @v is not modified and relaxed ordering is provided. 2037 2037 * 2038 2038 * Safe to use in noinstr code; prefer atomic_cmpxchg_acquire() elsewhere. 2039 2039 * ··· 2063 2061 * @new: int value to assign 2064 2062 * 2065 2063 * If (@v == @old), atomically updates @v to @new with release ordering. 2064 + * Otherwise, @v is not modified and relaxed ordering is provided. 2066 2065 * 2067 2066 * Safe to use in noinstr code; prefer atomic_cmpxchg_release() elsewhere. 2068 2067 * ··· 2091 2088 * @new: int value to assign 2092 2089 * 2093 2090 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 2091 + * Otherwise, @v is not modified and relaxed ordering is provided. 2094 2092 * 2095 2093 * Safe to use in noinstr code; prefer atomic_cmpxchg_relaxed() elsewhere. 2096 2094 * ··· 2116 2112 * @new: int value to assign 2117 2113 * 2118 2114 * If (@v == @old), atomically updates @v to @new with full ordering. 2119 - * Otherwise, updates @old to the current value of @v. 2115 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 2116 + * and relaxed ordering is provided. 2120 2117 * 2121 2118 * Safe to use in noinstr code; prefer atomic_try_cmpxchg() elsewhere. 2122 2119 * ··· 2150 2145 * @new: int value to assign 2151 2146 * 2152 2147 * If (@v == @old), atomically updates @v to @new with acquire ordering. 2153 - * Otherwise, updates @old to the current value of @v. 2148 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 2149 + * and relaxed ordering is provided. 2154 2150 * 2155 2151 * Safe to use in noinstr code; prefer atomic_try_cmpxchg_acquire() elsewhere. 2156 2152 * ··· 2184 2178 * @new: int value to assign 2185 2179 * 2186 2180 * If (@v == @old), atomically updates @v to @new with release ordering. 2187 - * Otherwise, updates @old to the current value of @v. 2181 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 2182 + * and relaxed ordering is provided. 2188 2183 * 2189 2184 * Safe to use in noinstr code; prefer atomic_try_cmpxchg_release() elsewhere. 2190 2185 * ··· 2217 2210 * @new: int value to assign 2218 2211 * 2219 2212 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 2220 - * Otherwise, updates @old to the current value of @v. 2213 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 2214 + * and relaxed ordering is provided. 2221 2215 * 2222 2216 * Safe to use in noinstr code; prefer atomic_try_cmpxchg_relaxed() elsewhere. 2223 2217 * ··· 2411 2403 * @u: int value to compare with 2412 2404 * 2413 2405 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 2406 + * Otherwise, @v is not modified and relaxed ordering is provided. 2414 2407 * 2415 2408 * Safe to use in noinstr code; prefer atomic_fetch_add_unless() elsewhere. 2416 2409 * ··· 2441 2432 * @u: int value to compare with 2442 2433 * 2443 2434 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 2435 + * Otherwise, @v is not modified and relaxed ordering is provided. 2444 2436 * 2445 2437 * Safe to use in noinstr code; prefer atomic_add_unless() elsewhere. 2446 2438 * ··· 2462 2452 * @v: pointer to atomic_t 2463 2453 * 2464 2454 * If (@v != 0), atomically updates @v to (@v + 1) with full ordering. 2455 + * Otherwise, @v is not modified and relaxed ordering is provided. 2465 2456 * 2466 2457 * Safe to use in noinstr code; prefer atomic_inc_not_zero() elsewhere. 2467 2458 * ··· 2483 2472 * @v: pointer to atomic_t 2484 2473 * 2485 2474 * If (@v >= 0), atomically updates @v to (@v + 1) with full ordering. 2475 + * Otherwise, @v is not modified and relaxed ordering is provided. 2486 2476 * 2487 2477 * Safe to use in noinstr code; prefer atomic_inc_unless_negative() elsewhere. 2488 2478 * ··· 2511 2499 * @v: pointer to atomic_t 2512 2500 * 2513 2501 * If (@v <= 0), atomically updates @v to (@v - 1) with full ordering. 2502 + * Otherwise, @v is not modified and relaxed ordering is provided. 2514 2503 * 2515 2504 * Safe to use in noinstr code; prefer atomic_dec_unless_positive() elsewhere. 2516 2505 * ··· 2539 2526 * @v: pointer to atomic_t 2540 2527 * 2541 2528 * If (@v > 0), atomically updates @v to (@v - 1) with full ordering. 2529 + * Otherwise, @v is not modified and relaxed ordering is provided. 2542 2530 * 2543 2531 * Safe to use in noinstr code; prefer atomic_dec_if_positive() elsewhere. 2544 2532 * ··· 4131 4117 * @new: s64 value to assign 4132 4118 * 4133 4119 * If (@v == @old), atomically updates @v to @new with full ordering. 4120 + * Otherwise, @v is not modified and relaxed ordering is provided. 4134 4121 * 4135 4122 * Safe to use in noinstr code; prefer atomic64_cmpxchg() elsewhere. 4136 4123 * ··· 4160 4145 * @new: s64 value to assign 4161 4146 * 4162 4147 * If (@v == @old), atomically updates @v to @new with acquire ordering. 4148 + * Otherwise, @v is not modified and relaxed ordering is provided. 4163 4149 * 4164 4150 * Safe to use in noinstr code; prefer atomic64_cmpxchg_acquire() elsewhere. 4165 4151 * ··· 4189 4173 * @new: s64 value to assign 4190 4174 * 4191 4175 * If (@v == @old), atomically updates @v to @new with release ordering. 4176 + * Otherwise, @v is not modified and relaxed ordering is provided. 4192 4177 * 4193 4178 * Safe to use in noinstr code; prefer atomic64_cmpxchg_release() elsewhere. 4194 4179 * ··· 4217 4200 * @new: s64 value to assign 4218 4201 * 4219 4202 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 4203 + * Otherwise, @v is not modified and relaxed ordering is provided. 4220 4204 * 4221 4205 * Safe to use in noinstr code; prefer atomic64_cmpxchg_relaxed() elsewhere. 4222 4206 * ··· 4242 4224 * @new: s64 value to assign 4243 4225 * 4244 4226 * If (@v == @old), atomically updates @v to @new with full ordering. 4245 - * Otherwise, updates @old to the current value of @v. 4227 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 4228 + * and relaxed ordering is provided. 4246 4229 * 4247 4230 * Safe to use in noinstr code; prefer atomic64_try_cmpxchg() elsewhere. 4248 4231 * ··· 4276 4257 * @new: s64 value to assign 4277 4258 * 4278 4259 * If (@v == @old), atomically updates @v to @new with acquire ordering. 4279 - * Otherwise, updates @old to the current value of @v. 4260 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 4261 + * and relaxed ordering is provided. 4280 4262 * 4281 4263 * Safe to use in noinstr code; prefer atomic64_try_cmpxchg_acquire() elsewhere. 4282 4264 * ··· 4310 4290 * @new: s64 value to assign 4311 4291 * 4312 4292 * If (@v == @old), atomically updates @v to @new with release ordering. 4313 - * Otherwise, updates @old to the current value of @v. 4293 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 4294 + * and relaxed ordering is provided. 4314 4295 * 4315 4296 * Safe to use in noinstr code; prefer atomic64_try_cmpxchg_release() elsewhere. 4316 4297 * ··· 4343 4322 * @new: s64 value to assign 4344 4323 * 4345 4324 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 4346 - * Otherwise, updates @old to the current value of @v. 4325 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 4326 + * and relaxed ordering is provided. 4347 4327 * 4348 4328 * Safe to use in noinstr code; prefer atomic64_try_cmpxchg_relaxed() elsewhere. 4349 4329 * ··· 4537 4515 * @u: s64 value to compare with 4538 4516 * 4539 4517 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 4518 + * Otherwise, @v is not modified and relaxed ordering is provided. 4540 4519 * 4541 4520 * Safe to use in noinstr code; prefer atomic64_fetch_add_unless() elsewhere. 4542 4521 * ··· 4567 4544 * @u: s64 value to compare with 4568 4545 * 4569 4546 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 4547 + * Otherwise, @v is not modified and relaxed ordering is provided. 4570 4548 * 4571 4549 * Safe to use in noinstr code; prefer atomic64_add_unless() elsewhere. 4572 4550 * ··· 4588 4564 * @v: pointer to atomic64_t 4589 4565 * 4590 4566 * If (@v != 0), atomically updates @v to (@v + 1) with full ordering. 4567 + * Otherwise, @v is not modified and relaxed ordering is provided. 4591 4568 * 4592 4569 * Safe to use in noinstr code; prefer atomic64_inc_not_zero() elsewhere. 4593 4570 * ··· 4609 4584 * @v: pointer to atomic64_t 4610 4585 * 4611 4586 * If (@v >= 0), atomically updates @v to (@v + 1) with full ordering. 4587 + * Otherwise, @v is not modified and relaxed ordering is provided. 4612 4588 * 4613 4589 * Safe to use in noinstr code; prefer atomic64_inc_unless_negative() elsewhere. 4614 4590 * ··· 4637 4611 * @v: pointer to atomic64_t 4638 4612 * 4639 4613 * If (@v <= 0), atomically updates @v to (@v - 1) with full ordering. 4614 + * Otherwise, @v is not modified and relaxed ordering is provided. 4640 4615 * 4641 4616 * Safe to use in noinstr code; prefer atomic64_dec_unless_positive() elsewhere. 4642 4617 * ··· 4665 4638 * @v: pointer to atomic64_t 4666 4639 * 4667 4640 * If (@v > 0), atomically updates @v to (@v - 1) with full ordering. 4641 + * Otherwise, @v is not modified and relaxed ordering is provided. 4668 4642 * 4669 4643 * Safe to use in noinstr code; prefer atomic64_dec_if_positive() elsewhere. 4670 4644 * ··· 4690 4662 } 4691 4663 4692 4664 #endif /* _LINUX_ATOMIC_FALLBACK_H */ 4693 - // eec048affea735b8464f58e6d96992101f8f85f1 4665 + // 14850c0b0db20c62fdc78ccd1d42b98b88d76331
+55 -13
include/linux/atomic/atomic-instrumented.h
··· 1182 1182 * @new: int value to assign 1183 1183 * 1184 1184 * If (@v == @old), atomically updates @v to @new with full ordering. 1185 + * Otherwise, @v is not modified and relaxed ordering is provided. 1185 1186 * 1186 1187 * Unsafe to use in noinstr code; use raw_atomic_cmpxchg() there. 1187 1188 * ··· 1203 1202 * @new: int value to assign 1204 1203 * 1205 1204 * If (@v == @old), atomically updates @v to @new with acquire ordering. 1205 + * Otherwise, @v is not modified and relaxed ordering is provided. 1206 1206 * 1207 1207 * Unsafe to use in noinstr code; use raw_atomic_cmpxchg_acquire() there. 1208 1208 * ··· 1223 1221 * @new: int value to assign 1224 1222 * 1225 1223 * If (@v == @old), atomically updates @v to @new with release ordering. 1224 + * Otherwise, @v is not modified and relaxed ordering is provided. 1226 1225 * 1227 1226 * Unsafe to use in noinstr code; use raw_atomic_cmpxchg_release() there. 1228 1227 * ··· 1244 1241 * @new: int value to assign 1245 1242 * 1246 1243 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 1244 + * Otherwise, @v is not modified and relaxed ordering is provided. 1247 1245 * 1248 1246 * Unsafe to use in noinstr code; use raw_atomic_cmpxchg_relaxed() there. 1249 1247 * ··· 1264 1260 * @new: int value to assign 1265 1261 * 1266 1262 * If (@v == @old), atomically updates @v to @new with full ordering. 1267 - * Otherwise, updates @old to the current value of @v. 1263 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 1264 + * and relaxed ordering is provided. 1268 1265 * 1269 1266 * Unsafe to use in noinstr code; use raw_atomic_try_cmpxchg() there. 1270 1267 * ··· 1287 1282 * @new: int value to assign 1288 1283 * 1289 1284 * If (@v == @old), atomically updates @v to @new with acquire ordering. 1290 - * Otherwise, updates @old to the current value of @v. 1285 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 1286 + * and relaxed ordering is provided. 1291 1287 * 1292 1288 * Unsafe to use in noinstr code; use raw_atomic_try_cmpxchg_acquire() there. 1293 1289 * ··· 1309 1303 * @new: int value to assign 1310 1304 * 1311 1305 * If (@v == @old), atomically updates @v to @new with release ordering. 1312 - * Otherwise, updates @old to the current value of @v. 1306 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 1307 + * and relaxed ordering is provided. 1313 1308 * 1314 1309 * Unsafe to use in noinstr code; use raw_atomic_try_cmpxchg_release() there. 1315 1310 * ··· 1332 1325 * @new: int value to assign 1333 1326 * 1334 1327 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 1335 - * Otherwise, updates @old to the current value of @v. 1328 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 1329 + * and relaxed ordering is provided. 1336 1330 * 1337 1331 * Unsafe to use in noinstr code; use raw_atomic_try_cmpxchg_relaxed() there. 1338 1332 * ··· 1483 1475 * @u: int value to compare with 1484 1476 * 1485 1477 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 1478 + * Otherwise, @v is not modified and relaxed ordering is provided. 1486 1479 * 1487 1480 * Unsafe to use in noinstr code; use raw_atomic_fetch_add_unless() there. 1488 1481 * ··· 1504 1495 * @u: int value to compare with 1505 1496 * 1506 1497 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 1498 + * Otherwise, @v is not modified and relaxed ordering is provided. 1507 1499 * 1508 1500 * Unsafe to use in noinstr code; use raw_atomic_add_unless() there. 1509 1501 * ··· 1523 1513 * @v: pointer to atomic_t 1524 1514 * 1525 1515 * If (@v != 0), atomically updates @v to (@v + 1) with full ordering. 1516 + * Otherwise, @v is not modified and relaxed ordering is provided. 1526 1517 * 1527 1518 * Unsafe to use in noinstr code; use raw_atomic_inc_not_zero() there. 1528 1519 * ··· 1542 1531 * @v: pointer to atomic_t 1543 1532 * 1544 1533 * If (@v >= 0), atomically updates @v to (@v + 1) with full ordering. 1534 + * Otherwise, @v is not modified and relaxed ordering is provided. 1545 1535 * 1546 1536 * Unsafe to use in noinstr code; use raw_atomic_inc_unless_negative() there. 1547 1537 * ··· 1561 1549 * @v: pointer to atomic_t 1562 1550 * 1563 1551 * If (@v <= 0), atomically updates @v to (@v - 1) with full ordering. 1552 + * Otherwise, @v is not modified and relaxed ordering is provided. 1564 1553 * 1565 1554 * Unsafe to use in noinstr code; use raw_atomic_dec_unless_positive() there. 1566 1555 * ··· 1580 1567 * @v: pointer to atomic_t 1581 1568 * 1582 1569 * If (@v > 0), atomically updates @v to (@v - 1) with full ordering. 1570 + * Otherwise, @v is not modified and relaxed ordering is provided. 1583 1571 * 1584 1572 * Unsafe to use in noinstr code; use raw_atomic_dec_if_positive() there. 1585 1573 * ··· 2760 2746 * @new: s64 value to assign 2761 2747 * 2762 2748 * If (@v == @old), atomically updates @v to @new with full ordering. 2749 + * Otherwise, @v is not modified and relaxed ordering is provided. 2763 2750 * 2764 2751 * Unsafe to use in noinstr code; use raw_atomic64_cmpxchg() there. 2765 2752 * ··· 2781 2766 * @new: s64 value to assign 2782 2767 * 2783 2768 * If (@v == @old), atomically updates @v to @new with acquire ordering. 2769 + * Otherwise, @v is not modified and relaxed ordering is provided. 2784 2770 * 2785 2771 * Unsafe to use in noinstr code; use raw_atomic64_cmpxchg_acquire() there. 2786 2772 * ··· 2801 2785 * @new: s64 value to assign 2802 2786 * 2803 2787 * If (@v == @old), atomically updates @v to @new with release ordering. 2788 + * Otherwise, @v is not modified and relaxed ordering is provided. 2804 2789 * 2805 2790 * Unsafe to use in noinstr code; use raw_atomic64_cmpxchg_release() there. 2806 2791 * ··· 2822 2805 * @new: s64 value to assign 2823 2806 * 2824 2807 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 2808 + * Otherwise, @v is not modified and relaxed ordering is provided. 2825 2809 * 2826 2810 * Unsafe to use in noinstr code; use raw_atomic64_cmpxchg_relaxed() there. 2827 2811 * ··· 2842 2824 * @new: s64 value to assign 2843 2825 * 2844 2826 * If (@v == @old), atomically updates @v to @new with full ordering. 2845 - * Otherwise, updates @old to the current value of @v. 2827 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 2828 + * and relaxed ordering is provided. 2846 2829 * 2847 2830 * Unsafe to use in noinstr code; use raw_atomic64_try_cmpxchg() there. 2848 2831 * ··· 2865 2846 * @new: s64 value to assign 2866 2847 * 2867 2848 * If (@v == @old), atomically updates @v to @new with acquire ordering. 2868 - * Otherwise, updates @old to the current value of @v. 2849 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 2850 + * and relaxed ordering is provided. 2869 2851 * 2870 2852 * Unsafe to use in noinstr code; use raw_atomic64_try_cmpxchg_acquire() there. 2871 2853 * ··· 2887 2867 * @new: s64 value to assign 2888 2868 * 2889 2869 * If (@v == @old), atomically updates @v to @new with release ordering. 2890 - * Otherwise, updates @old to the current value of @v. 2870 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 2871 + * and relaxed ordering is provided. 2891 2872 * 2892 2873 * Unsafe to use in noinstr code; use raw_atomic64_try_cmpxchg_release() there. 2893 2874 * ··· 2910 2889 * @new: s64 value to assign 2911 2890 * 2912 2891 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 2913 - * Otherwise, updates @old to the current value of @v. 2892 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 2893 + * and relaxed ordering is provided. 2914 2894 * 2915 2895 * Unsafe to use in noinstr code; use raw_atomic64_try_cmpxchg_relaxed() there. 2916 2896 * ··· 3061 3039 * @u: s64 value to compare with 3062 3040 * 3063 3041 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 3042 + * Otherwise, @v is not modified and relaxed ordering is provided. 3064 3043 * 3065 3044 * Unsafe to use in noinstr code; use raw_atomic64_fetch_add_unless() there. 3066 3045 * ··· 3082 3059 * @u: s64 value to compare with 3083 3060 * 3084 3061 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 3062 + * Otherwise, @v is not modified and relaxed ordering is provided. 3085 3063 * 3086 3064 * Unsafe to use in noinstr code; use raw_atomic64_add_unless() there. 3087 3065 * ··· 3101 3077 * @v: pointer to atomic64_t 3102 3078 * 3103 3079 * If (@v != 0), atomically updates @v to (@v + 1) with full ordering. 3080 + * Otherwise, @v is not modified and relaxed ordering is provided. 3104 3081 * 3105 3082 * Unsafe to use in noinstr code; use raw_atomic64_inc_not_zero() there. 3106 3083 * ··· 3120 3095 * @v: pointer to atomic64_t 3121 3096 * 3122 3097 * If (@v >= 0), atomically updates @v to (@v + 1) with full ordering. 3098 + * Otherwise, @v is not modified and relaxed ordering is provided. 3123 3099 * 3124 3100 * Unsafe to use in noinstr code; use raw_atomic64_inc_unless_negative() there. 3125 3101 * ··· 3139 3113 * @v: pointer to atomic64_t 3140 3114 * 3141 3115 * If (@v <= 0), atomically updates @v to (@v - 1) with full ordering. 3116 + * Otherwise, @v is not modified and relaxed ordering is provided. 3142 3117 * 3143 3118 * Unsafe to use in noinstr code; use raw_atomic64_dec_unless_positive() there. 3144 3119 * ··· 3158 3131 * @v: pointer to atomic64_t 3159 3132 * 3160 3133 * If (@v > 0), atomically updates @v to (@v - 1) with full ordering. 3134 + * Otherwise, @v is not modified and relaxed ordering is provided. 3161 3135 * 3162 3136 * Unsafe to use in noinstr code; use raw_atomic64_dec_if_positive() there. 3163 3137 * ··· 4338 4310 * @new: long value to assign 4339 4311 * 4340 4312 * If (@v == @old), atomically updates @v to @new with full ordering. 4313 + * Otherwise, @v is not modified and relaxed ordering is provided. 4341 4314 * 4342 4315 * Unsafe to use in noinstr code; use raw_atomic_long_cmpxchg() there. 4343 4316 * ··· 4359 4330 * @new: long value to assign 4360 4331 * 4361 4332 * If (@v == @old), atomically updates @v to @new with acquire ordering. 4333 + * Otherwise, @v is not modified and relaxed ordering is provided. 4362 4334 * 4363 4335 * Unsafe to use in noinstr code; use raw_atomic_long_cmpxchg_acquire() there. 4364 4336 * ··· 4379 4349 * @new: long value to assign 4380 4350 * 4381 4351 * If (@v == @old), atomically updates @v to @new with release ordering. 4352 + * Otherwise, @v is not modified and relaxed ordering is provided. 4382 4353 * 4383 4354 * Unsafe to use in noinstr code; use raw_atomic_long_cmpxchg_release() there. 4384 4355 * ··· 4400 4369 * @new: long value to assign 4401 4370 * 4402 4371 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 4372 + * Otherwise, @v is not modified and relaxed ordering is provided. 4403 4373 * 4404 4374 * Unsafe to use in noinstr code; use raw_atomic_long_cmpxchg_relaxed() there. 4405 4375 * ··· 4420 4388 * @new: long value to assign 4421 4389 * 4422 4390 * If (@v == @old), atomically updates @v to @new with full ordering. 4423 - * Otherwise, updates @old to the current value of @v. 4391 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 4392 + * and relaxed ordering is provided. 4424 4393 * 4425 4394 * Unsafe to use in noinstr code; use raw_atomic_long_try_cmpxchg() there. 4426 4395 * ··· 4443 4410 * @new: long value to assign 4444 4411 * 4445 4412 * If (@v == @old), atomically updates @v to @new with acquire ordering. 4446 - * Otherwise, updates @old to the current value of @v. 4413 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 4414 + * and relaxed ordering is provided. 4447 4415 * 4448 4416 * Unsafe to use in noinstr code; use raw_atomic_long_try_cmpxchg_acquire() there. 4449 4417 * ··· 4465 4431 * @new: long value to assign 4466 4432 * 4467 4433 * If (@v == @old), atomically updates @v to @new with release ordering. 4468 - * Otherwise, updates @old to the current value of @v. 4434 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 4435 + * and relaxed ordering is provided. 4469 4436 * 4470 4437 * Unsafe to use in noinstr code; use raw_atomic_long_try_cmpxchg_release() there. 4471 4438 * ··· 4488 4453 * @new: long value to assign 4489 4454 * 4490 4455 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 4491 - * Otherwise, updates @old to the current value of @v. 4456 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 4457 + * and relaxed ordering is provided. 4492 4458 * 4493 4459 * Unsafe to use in noinstr code; use raw_atomic_long_try_cmpxchg_relaxed() there. 4494 4460 * ··· 4639 4603 * @u: long value to compare with 4640 4604 * 4641 4605 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 4606 + * Otherwise, @v is not modified and relaxed ordering is provided. 4642 4607 * 4643 4608 * Unsafe to use in noinstr code; use raw_atomic_long_fetch_add_unless() there. 4644 4609 * ··· 4660 4623 * @u: long value to compare with 4661 4624 * 4662 4625 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 4626 + * Otherwise, @v is not modified and relaxed ordering is provided. 4663 4627 * 4664 4628 * Unsafe to use in noinstr code; use raw_atomic_long_add_unless() there. 4665 4629 * ··· 4679 4641 * @v: pointer to atomic_long_t 4680 4642 * 4681 4643 * If (@v != 0), atomically updates @v to (@v + 1) with full ordering. 4644 + * Otherwise, @v is not modified and relaxed ordering is provided. 4682 4645 * 4683 4646 * Unsafe to use in noinstr code; use raw_atomic_long_inc_not_zero() there. 4684 4647 * ··· 4698 4659 * @v: pointer to atomic_long_t 4699 4660 * 4700 4661 * If (@v >= 0), atomically updates @v to (@v + 1) with full ordering. 4662 + * Otherwise, @v is not modified and relaxed ordering is provided. 4701 4663 * 4702 4664 * Unsafe to use in noinstr code; use raw_atomic_long_inc_unless_negative() there. 4703 4665 * ··· 4717 4677 * @v: pointer to atomic_long_t 4718 4678 * 4719 4679 * If (@v <= 0), atomically updates @v to (@v - 1) with full ordering. 4680 + * Otherwise, @v is not modified and relaxed ordering is provided. 4720 4681 * 4721 4682 * Unsafe to use in noinstr code; use raw_atomic_long_dec_unless_positive() there. 4722 4683 * ··· 4736 4695 * @v: pointer to atomic_long_t 4737 4696 * 4738 4697 * If (@v > 0), atomically updates @v to (@v - 1) with full ordering. 4698 + * Otherwise, @v is not modified and relaxed ordering is provided. 4739 4699 * 4740 4700 * Unsafe to use in noinstr code; use raw_atomic_long_dec_if_positive() there. 4741 4701 * ··· 5050 5008 5051 5009 5052 5010 #endif /* _LINUX_ATOMIC_INSTRUMENTED_H */ 5053 - // 2cc4bc990fef44d3836ec108f11b610f3f438184 5011 + // ce5b65e0f1f8a276268b667194581d24bed219d4
+19 -5
include/linux/atomic/atomic-long.h
··· 1352 1352 * @new: long value to assign 1353 1353 * 1354 1354 * If (@v == @old), atomically updates @v to @new with full ordering. 1355 + * Otherwise, @v is not modified and relaxed ordering is provided. 1355 1356 * 1356 1357 * Safe to use in noinstr code; prefer atomic_long_cmpxchg() elsewhere. 1357 1358 * ··· 1375 1374 * @new: long value to assign 1376 1375 * 1377 1376 * If (@v == @old), atomically updates @v to @new with acquire ordering. 1377 + * Otherwise, @v is not modified and relaxed ordering is provided. 1378 1378 * 1379 1379 * Safe to use in noinstr code; prefer atomic_long_cmpxchg_acquire() elsewhere. 1380 1380 * ··· 1398 1396 * @new: long value to assign 1399 1397 * 1400 1398 * If (@v == @old), atomically updates @v to @new with release ordering. 1399 + * Otherwise, @v is not modified and relaxed ordering is provided. 1401 1400 * 1402 1401 * Safe to use in noinstr code; prefer atomic_long_cmpxchg_release() elsewhere. 1403 1402 * ··· 1421 1418 * @new: long value to assign 1422 1419 * 1423 1420 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 1421 + * Otherwise, @v is not modified and relaxed ordering is provided. 1424 1422 * 1425 1423 * Safe to use in noinstr code; prefer atomic_long_cmpxchg_relaxed() elsewhere. 1426 1424 * ··· 1444 1440 * @new: long value to assign 1445 1441 * 1446 1442 * If (@v == @old), atomically updates @v to @new with full ordering. 1447 - * Otherwise, updates @old to the current value of @v. 1443 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 1444 + * and relaxed ordering is provided. 1448 1445 * 1449 1446 * Safe to use in noinstr code; prefer atomic_long_try_cmpxchg() elsewhere. 1450 1447 * ··· 1468 1463 * @new: long value to assign 1469 1464 * 1470 1465 * If (@v == @old), atomically updates @v to @new with acquire ordering. 1471 - * Otherwise, updates @old to the current value of @v. 1466 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 1467 + * and relaxed ordering is provided. 1472 1468 * 1473 1469 * Safe to use in noinstr code; prefer atomic_long_try_cmpxchg_acquire() elsewhere. 1474 1470 * ··· 1492 1486 * @new: long value to assign 1493 1487 * 1494 1488 * If (@v == @old), atomically updates @v to @new with release ordering. 1495 - * Otherwise, updates @old to the current value of @v. 1489 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 1490 + * and relaxed ordering is provided. 1496 1491 * 1497 1492 * Safe to use in noinstr code; prefer atomic_long_try_cmpxchg_release() elsewhere. 1498 1493 * ··· 1516 1509 * @new: long value to assign 1517 1510 * 1518 1511 * If (@v == @old), atomically updates @v to @new with relaxed ordering. 1519 - * Otherwise, updates @old to the current value of @v. 1512 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 1513 + * and relaxed ordering is provided. 1520 1514 * 1521 1515 * Safe to use in noinstr code; prefer atomic_long_try_cmpxchg_relaxed() elsewhere. 1522 1516 * ··· 1685 1677 * @u: long value to compare with 1686 1678 * 1687 1679 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 1680 + * Otherwise, @v is not modified and relaxed ordering is provided. 1688 1681 * 1689 1682 * Safe to use in noinstr code; prefer atomic_long_fetch_add_unless() elsewhere. 1690 1683 * ··· 1708 1699 * @u: long value to compare with 1709 1700 * 1710 1701 * If (@v != @u), atomically updates @v to (@v + @a) with full ordering. 1702 + * Otherwise, @v is not modified and relaxed ordering is provided. 1711 1703 * 1712 1704 * Safe to use in noinstr code; prefer atomic_long_add_unless() elsewhere. 1713 1705 * ··· 1729 1719 * @v: pointer to atomic_long_t 1730 1720 * 1731 1721 * If (@v != 0), atomically updates @v to (@v + 1) with full ordering. 1722 + * Otherwise, @v is not modified and relaxed ordering is provided. 1732 1723 * 1733 1724 * Safe to use in noinstr code; prefer atomic_long_inc_not_zero() elsewhere. 1734 1725 * ··· 1750 1739 * @v: pointer to atomic_long_t 1751 1740 * 1752 1741 * If (@v >= 0), atomically updates @v to (@v + 1) with full ordering. 1742 + * Otherwise, @v is not modified and relaxed ordering is provided. 1753 1743 * 1754 1744 * Safe to use in noinstr code; prefer atomic_long_inc_unless_negative() elsewhere. 1755 1745 * ··· 1771 1759 * @v: pointer to atomic_long_t 1772 1760 * 1773 1761 * If (@v <= 0), atomically updates @v to (@v - 1) with full ordering. 1762 + * Otherwise, @v is not modified and relaxed ordering is provided. 1774 1763 * 1775 1764 * Safe to use in noinstr code; prefer atomic_long_dec_unless_positive() elsewhere. 1776 1765 * ··· 1792 1779 * @v: pointer to atomic_long_t 1793 1780 * 1794 1781 * If (@v > 0), atomically updates @v to (@v - 1) with full ordering. 1782 + * Otherwise, @v is not modified and relaxed ordering is provided. 1795 1783 * 1796 1784 * Safe to use in noinstr code; prefer atomic_long_dec_if_positive() elsewhere. 1797 1785 * ··· 1809 1795 } 1810 1796 1811 1797 #endif /* _LINUX_ATOMIC_LONG_H */ 1812 - // 4ef23f98c73cff96d239896175fd26b10b88899e 1798 + // 1c4a26fc77f345342953770ebe3c4d08e7ce2f9a
+1
scripts/atomic/kerneldoc/add_unless
··· 10 10 * @u: ${int} value to compare with 11 11 * 12 12 * If (@v != @u), atomically updates @v to (@v + @a) with ${desc_order} ordering. 13 + * Otherwise, @v is not modified and relaxed ordering is provided. 13 14 * 14 15 * ${desc_noinstr} 15 16 *
+1
scripts/atomic/kerneldoc/cmpxchg
··· 6 6 * @new: ${int} value to assign 7 7 * 8 8 * If (@v == @old), atomically updates @v to @new with ${desc_order} ordering. 9 + * Otherwise, @v is not modified and relaxed ordering is provided. 9 10 * 10 11 * ${desc_noinstr} 11 12 *
+1
scripts/atomic/kerneldoc/dec_if_positive
··· 4 4 * @v: pointer to ${atomic}_t 5 5 * 6 6 * If (@v > 0), atomically updates @v to (@v - 1) with ${desc_order} ordering. 7 + * Otherwise, @v is not modified and relaxed ordering is provided. 7 8 * 8 9 * ${desc_noinstr} 9 10 *
+1
scripts/atomic/kerneldoc/dec_unless_positive
··· 4 4 * @v: pointer to ${atomic}_t 5 5 * 6 6 * If (@v <= 0), atomically updates @v to (@v - 1) with ${desc_order} ordering. 7 + * Otherwise, @v is not modified and relaxed ordering is provided. 7 8 * 8 9 * ${desc_noinstr} 9 10 *
+1
scripts/atomic/kerneldoc/inc_not_zero
··· 4 4 * @v: pointer to ${atomic}_t 5 5 * 6 6 * If (@v != 0), atomically updates @v to (@v + 1) with ${desc_order} ordering. 7 + * Otherwise, @v is not modified and relaxed ordering is provided. 7 8 * 8 9 * ${desc_noinstr} 9 10 *
+1
scripts/atomic/kerneldoc/inc_unless_negative
··· 4 4 * @v: pointer to ${atomic}_t 5 5 * 6 6 * If (@v >= 0), atomically updates @v to (@v + 1) with ${desc_order} ordering. 7 + * Otherwise, @v is not modified and relaxed ordering is provided. 7 8 * 8 9 * ${desc_noinstr} 9 10 *
+2 -1
scripts/atomic/kerneldoc/try_cmpxchg
··· 6 6 * @new: ${int} value to assign 7 7 * 8 8 * If (@v == @old), atomically updates @v to @new with ${desc_order} ordering. 9 - * Otherwise, updates @old to the current value of @v. 9 + * Otherwise, @v is not modified, @old is updated to the current value of @v, 10 + * and relaxed ordering is provided. 10 11 * 11 12 * ${desc_noinstr} 12 13 *