History

atomics: Provide atomic_add_negative() variants

atomic_add_negative() does not provide the relaxed/acquire/release variants. Provide them in preparation for a new scalable reference count algorithm.

Thomas Gleixner committed 3 years ago

Commit e5ab9ef1 parent fe15c265 files · +309 −18Browse files

Showing the changes to scripts (2 of 5 files). Show all

Unified · Split

2 files
  1. scripts/atomic/atomics.tbl +1 −1
  2. scripts/atomic/fallbacks/add_negative +5 −6
scripts/atomic/atomics.tbl+1−1
@@ -33,7 +33,7 @@ try_cmpxchg B v p:old i:new · 32 unmodified lines
33sub_and_test b i v33sub_and_test b i v
34dec_and_test b v34dec_and_test b v
35inc_and_test b v35inc_and_test b v
36add_negative b i v36add_negative B i v
37add_unless fb v i:a i:u37add_unless fb v i:a i:u
38inc_not_zero b v38inc_not_zero b v
39inc_unless_negative b v39inc_unless_negative b v
scripts/atomic/fallbacks/add_negative+5−6
@@ -1,16 +1,15 @@
1cat <<EOF1cat <<EOF
2/**2/**
3 * arch_${atomic}_add_negative - add and test if negative3 * arch_${atomic}_add_negative${order} - Add and test if negative
4 * @i: integer value to add4 * @i: integer value to add
5 * @v: pointer of type ${atomic}_t5 * @v: pointer of type ${atomic}_t
6 *6 *
7 * Atomically adds @i to @v and returns true7 * Atomically adds @i to @v and returns true if the result is negative,
8 * if the result is negative, or false when8 * or false when the result is greater than or equal to zero.
9 * result is greater than or equal to zero.
10 */9 */
11static __always_inline bool10static __always_inline bool
12arch_${atomic}_add_negative(${int} i, ${atomic}_t *v)11arch_${atomic}_add_negative${order}(${int} i, ${atomic}_t *v)
13{12{
14 return arch_${atomic}_add_return(i, v) < 0;13 return arch_${atomic}_add_return${order}(i, v) < 0;
15}14}
16EOF15EOF

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t