git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
usbnet: ratelimit warning messages invoked from callback handler
[safe/jmp/linux-2.6]
/
kernel
/
mutex.c
diff --git
a/kernel/mutex.c
b/kernel/mutex.c
index
ff42e97
..
507cf2b
100644
(file)
--- a/
kernel/mutex.c
+++ b/
kernel/mutex.c
@@
-148,7
+148,8
@@
__mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
preempt_disable();
mutex_acquire(&lock->dep_map, subclass, 0, ip);
preempt_disable();
mutex_acquire(&lock->dep_map, subclass, 0, ip);
-#if defined(CONFIG_SMP) && !defined(CONFIG_DEBUG_MUTEXES)
+#if defined(CONFIG_SMP) && !defined(CONFIG_DEBUG_MUTEXES) && \
+ !defined(CONFIG_HAVE_DEFAULT_NO_SPIN_MUTEXES)
/*
* Optimistic spinning.
*
/*
* Optimistic spinning.
*
@@
-171,12
+172,6
@@
__mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
struct thread_info *owner;
/*
struct thread_info *owner;
/*
- * If there are pending waiters, join them.
- */
- if (!list_empty(&lock->wait_list))
- break;
-
- /*
* If there's an owner, wait for it to either
* release the lock or go to sleep.
*/
* If there's an owner, wait for it to either
* release the lock or go to sleep.
*/
@@
-184,6
+179,13
@@
__mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
if (owner && !mutex_spin_on_owner(lock, owner))
break;
if (owner && !mutex_spin_on_owner(lock, owner))
break;
+ if (atomic_cmpxchg(&lock->count, 1, 0) == 1) {
+ lock_acquired(&lock->dep_map, ip);
+ mutex_set_owner(lock);
+ preempt_enable();
+ return 0;
+ }
+
/*
* When there's no owner, we might have preempted between the
* owner acquiring the lock and setting the owner field. If
/*
* When there's no owner, we might have preempted between the
* owner acquiring the lock and setting the owner field. If
@@
-193,13
+195,6
@@
__mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
if (!owner && (need_resched() || rt_task(task)))
break;
if (!owner && (need_resched() || rt_task(task)))
break;
- if (atomic_cmpxchg(&lock->count, 1, 0) == 1) {
- lock_acquired(&lock->dep_map, ip);
- mutex_set_owner(lock);
- preempt_enable();
- return 0;
- }
-
/*
* The cpu_relax() call is a compiler barrier which forces
* everything in this loop to be re-loaded. We don't need
/*
* The cpu_relax() call is a compiler barrier which forces
* everything in this loop to be re-loaded. We don't need