aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorNick Piggin <nickpiggin@yahoo.com.au>2005-11-13 19:07:25 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-13 21:14:16 -0500
commit8426e1f6af0fd7f44d040af7263750c5a52f3cc3 (patch)
tree827bd2588c2b73d11cea6869de8ff42dba134375 /Documentation
parent4a6dae6d382e9edf3ff440b819e554ed706359bc (diff)
[PATCH] atomic: inc_not_zero
Introduce an atomic_inc_not_zero operation. Make this a special case of atomic_add_unless because lockless pagecache actually wants atomic_inc_not_negativeone due to its offset refcount. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/atomic_ops.txt14
1 files changed, 13 insertions, 1 deletions
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
index f1744161ef0..23a1c2402bc 100644
--- a/Documentation/atomic_ops.txt
+++ b/Documentation/atomic_ops.txt
@@ -115,7 +115,7 @@ boolean is return which indicates whether the resulting counter value
115is negative. It requires explicit memory barrier semantics around the 115is negative. It requires explicit memory barrier semantics around the
116operation. 116operation.
117 117
118Finally: 118Then:
119 119
120 int atomic_cmpxchg(atomic_t *v, int old, int new); 120 int atomic_cmpxchg(atomic_t *v, int old, int new);
121 121
@@ -129,6 +129,18 @@ atomic_cmpxchg requires explicit memory barriers around the operation.
129The semantics for atomic_cmpxchg are the same as those defined for 'cas' 129The semantics for atomic_cmpxchg are the same as those defined for 'cas'
130below. 130below.
131 131
132Finally:
133
134 int atomic_add_unless(atomic_t *v, int a, int u);
135
136If the atomic value v is not equal to u, this function adds a to v, and
137returns non zero. If v is equal to u then it returns zero. This is done as
138an atomic operation.
139
140atomic_add_unless requires explicit memory barriers around the operation.
141
142atomic_inc_not_zero, equivalent to atomic_add_unless(v, 1, 0)
143
132 144
133If a caller requires memory barrier semantics around an atomic_t 145If a caller requires memory barrier semantics around an atomic_t
134operation which does not return a value, a set of interfaces are 146operation which does not return a value, a set of interfaces are