-
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: 211943 b: refs/heads/master c: 8b92538 h: refs/heads/master i: 211941: fd80b10 211939: ad673e8 211935: 138f41d v: v3
- Loading branch information
Peter Zijlstra
authored and
Ingo Molnar
committed
Oct 18, 2010
1 parent
6b804a1
commit d7d2541
Showing
2 changed files
with
45 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: 3b6e901f839f42afb40f614418df82c08b01320a | ||
refs/heads/master: 8b92538d84e50062560ba33adbaed7887b6e4a42 |
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,44 @@ | ||
#ifndef _LINUX_JUMP_LABEL_REF_H | ||
#define _LINUX_JUMP_LABEL_REF_H | ||
|
||
#include <linux/jump_label.h> | ||
#include <asm/atomic.h> | ||
|
||
#ifdef HAVE_JUMP_LABEL | ||
|
||
static inline void jump_label_inc(atomic_t *key) | ||
{ | ||
if (atomic_add_return(1, key) == 1) | ||
jump_label_enable(key); | ||
} | ||
|
||
static inline void jump_label_dec(atomic_t *key) | ||
{ | ||
if (atomic_dec_and_test(key)) | ||
jump_label_disable(key); | ||
} | ||
|
||
#else /* !HAVE_JUMP_LABEL */ | ||
|
||
static inline void jump_label_inc(atomic_t *key) | ||
{ | ||
atomic_inc(key); | ||
} | ||
|
||
static inline void jump_label_dec(atomic_t *key) | ||
{ | ||
atomic_dec(key); | ||
} | ||
|
||
#undef JUMP_LABEL | ||
#define JUMP_LABEL(key, label) \ | ||
do { \ | ||
if (unlikely(__builtin_choose_expr( \ | ||
__builtin_types_compatible_p(typeof(key), atomic_t *), \ | ||
atomic_read((atomic_t *)(key)), *(key)))) \ | ||
goto label; \ | ||
} while (0) | ||
|
||
#endif /* HAVE_JUMP_LABEL */ | ||
|
||
#endif /* _LINUX_JUMP_LABEL_REF_H */ |