-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 221714 b: refs/heads/master c: 3f9d35b h: refs/heads/master v: v3
- Loading branch information
Eric Dumazet
authored and
Linus Torvalds
committed
Nov 12, 2010
1 parent
954b4f0
commit 534b672
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 8705a1baf78287eceeb00bc29401d0ae6a03f213 | ||
refs/heads/master: 3f9d35b9514da6757ca98831372518f9eeb71b33 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef _LINUX_ATOMIC_H | ||
#define _LINUX_ATOMIC_H | ||
#include <asm/atomic.h> | ||
|
||
/** | ||
* atomic_inc_not_zero_hint - increment if not null | ||
* @v: pointer of type atomic_t | ||
* @hint: probable value of the atomic before the increment | ||
* | ||
* This version of atomic_inc_not_zero() gives a hint of probable | ||
* value of the atomic. This helps processor to not read the memory | ||
* before doing the atomic read/modify/write cycle, lowering | ||
* number of bus transactions on some arches. | ||
* | ||
* Returns: 0 if increment was not done, 1 otherwise. | ||
*/ | ||
#ifndef atomic_inc_not_zero_hint | ||
static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint) | ||
{ | ||
int val, c = hint; | ||
|
||
/* sanity test, should be removed by compiler if hint is a constant */ | ||
if (!hint) | ||
return atomic_inc_not_zero(v); | ||
|
||
do { | ||
val = atomic_cmpxchg(v, c, c + 1); | ||
if (val == c) | ||
return 1; | ||
c = val; | ||
} while (c); | ||
|
||
return 0; | ||
} | ||
#endif | ||
|
||
#endif /* _LINUX_ATOMIC_H */ |