~ubuntu-branches/debian/experimental/linux-tools/experimental

« back to all changes in this revision

Viewing changes to include/linux/lockref.h

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings
  • Date: 2014-02-02 16:57:49 UTC
  • mfrom: (1.1.10) (0.1.21 sid)
  • Revision ID: package-import@ubuntu.com-20140202165749-tw94o9t1t0a8txk6
Tags: 3.13-1~exp2
Merge changes from sid up to 3.12.6-3

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 */
16
16
 
17
17
#include <linux/spinlock.h>
 
18
#include <generated/bounds.h>
 
19
 
 
20
#define USE_CMPXCHG_LOCKREF \
 
21
        (IS_ENABLED(CONFIG_ARCH_USE_CMPXCHG_LOCKREF) && \
 
22
         IS_ENABLED(CONFIG_SMP) && SPINLOCK_SIZE <= 4)
18
23
 
19
24
struct lockref {
20
25
        union {
21
 
#ifdef CONFIG_CMPXCHG_LOCKREF
 
26
#if USE_CMPXCHG_LOCKREF
22
27
                aligned_u64 lock_count;
23
28
#endif
24
29
                struct {
36
41
extern void lockref_mark_dead(struct lockref *);
37
42
extern int lockref_get_not_dead(struct lockref *);
38
43
 
 
44
/* Must be called under spinlock for reliable results */
 
45
static inline int __lockref_is_dead(const struct lockref *l)
 
46
{
 
47
        return ((int)l->count < 0);
 
48
}
 
49
 
39
50
#endif /* __LINUX_LOCKREF_H */