diff options
| author | Paul Moore <pmoore@redhat.com> | 2014-01-23 15:52:06 -0500 |
|---|---|---|
| committer | Paul Moore <pmoore@redhat.com> | 2014-01-23 15:52:06 -0500 |
| commit | 41be702a542a0d14bb0b1c16e824fa9ed27616ec (patch) | |
| tree | e48942a05882da47544e179c6a0c920e00137a6a /include/linux/lockref.h | |
| parent | 8ed814602876bec9bad2649ca17f34b499357a1c (diff) | |
| parent | d8ec26d7f8287f5788a494f56e8814210f0e64be (diff) | |
Merge tag 'v3.13' into next
Linux 3.13
Minor fixup needed in selinux_inet_conn_request()
Conflicts:
security/selinux/hooks.c
Diffstat (limited to 'include/linux/lockref.h')
| -rw-r--r-- | include/linux/lockref.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/linux/lockref.h b/include/linux/lockref.h index f279ed9a9163..4bfde0e99ed5 100644 --- a/include/linux/lockref.h +++ b/include/linux/lockref.h @@ -15,10 +15,15 @@ */ #include <linux/spinlock.h> +#include <generated/bounds.h> + +#define USE_CMPXCHG_LOCKREF \ + (IS_ENABLED(CONFIG_ARCH_USE_CMPXCHG_LOCKREF) && \ + IS_ENABLED(CONFIG_SMP) && SPINLOCK_SIZE <= 4) struct lockref { union { -#ifdef CONFIG_CMPXCHG_LOCKREF +#if USE_CMPXCHG_LOCKREF aligned_u64 lock_count; #endif struct { @@ -36,4 +41,10 @@ extern int lockref_put_or_lock(struct lockref *); extern void lockref_mark_dead(struct lockref *); extern int lockref_get_not_dead(struct lockref *); +/* Must be called under spinlock for reliable results */ +static inline int __lockref_is_dead(const struct lockref *l) +{ + return ((int)l->count < 0); +} + #endif /* __LINUX_LOCKREF_H */ |
