Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96341
b: refs/heads/master
c: 39f004b
h: refs/heads/master
i:
  96339: ac7ac09
v: v3
  • Loading branch information
Linus Torvalds committed May 11, 2008
1 parent c644dcf commit 0a484bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9c3cdc1f83a6e07092392ff4aba6466517dbd1d0
refs/heads/master: 39f004ba27fcd2431030a3bb3c949fa3f93fa4ca
18 changes: 4 additions & 14 deletions trunk/include/asm-x86/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,8 @@
*/

#ifdef CONFIG_X86_32
typedef char _slock_t;
# define LOCK_INS_DEC "decb"
# define LOCK_INS_XCH "xchgb"
# define LOCK_INS_MOV "movb"
# define LOCK_INS_CMP "cmpb"
# define LOCK_PTR_REG "a"
#else
typedef int _slock_t;
# define LOCK_INS_DEC "decl"
# define LOCK_INS_XCH "xchgl"
# define LOCK_INS_MOV "movl"
# define LOCK_INS_CMP "cmpl"
# define LOCK_PTR_REG "D"
#endif

Expand Down Expand Up @@ -66,14 +56,14 @@ typedef int _slock_t;
#if (NR_CPUS < 256)
static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
{
int tmp = *(volatile signed int *)(&(lock)->slock);
int tmp = ACCESS_ONCE(lock->slock);

return (((tmp >> 8) & 0xff) != (tmp & 0xff));
}

static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
{
int tmp = *(volatile signed int *)(&(lock)->slock);
int tmp = ACCESS_ONCE(lock->slock);

return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1;
}
Expand Down Expand Up @@ -130,14 +120,14 @@ static __always_inline void __raw_spin_unlock(raw_spinlock_t *lock)
#else
static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
{
int tmp = *(volatile signed int *)(&(lock)->slock);
int tmp = ACCESS_ONCE(lock->slock);

return (((tmp >> 16) & 0xffff) != (tmp & 0xffff));
}

static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
{
int tmp = *(volatile signed int *)(&(lock)->slock);
int tmp = ACCESS_ONCE(lock->slock);

return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1;
}
Expand Down

0 comments on commit 0a484bc

Please sign in to comment.