]> Git Repo - linux.git/commitdiff
Merge branch 'locking/urgent' into locking/core, before applying larger changes and...
authorIngo Molnar <[email protected]>
Thu, 17 Jul 2014 09:45:29 +0000 (11:45 +0200)
committerIngo Molnar <[email protected]>
Thu, 17 Jul 2014 09:45:29 +0000 (11:45 +0200)
Signed-off-by: Ingo Molnar <[email protected]>
1  2 
kernel/locking/mutex.c
lib/Kconfig.debug

diff --combined kernel/locking/mutex.c
index 11b103d87b278ef037a7d013000445f248ab18e1,acca2c1a3c5e550a42cae2256e0b88b02f352faa..d3100521388c04eb4cb78b7dd99f731542936eb1
  # include <asm/mutex.h>
  #endif
  
 -/*
 - * A negative mutex count indicates that waiters are sleeping waiting for the
 - * mutex.
 - */
 -#define       MUTEX_SHOW_NO_WAITER(mutex)     (atomic_read(&(mutex)->count) >= 0)
 -
  void
  __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)
  {
@@@ -54,7 -60,7 +54,7 @@@
        INIT_LIST_HEAD(&lock->wait_list);
        mutex_clear_owner(lock);
  #ifdef CONFIG_MUTEX_SPIN_ON_OWNER
-       lock->osq = NULL;
+       osq_lock_init(&lock->osq);
  #endif
  
        debug_mutex_init(lock, name, key);
@@@ -382,10 -388,12 +382,10 @@@ __mutex_lock_common(struct mutex *lock
        /*
         * Optimistic spinning.
         *
 -       * We try to spin for acquisition when we find that there are no
 -       * pending waiters and the lock owner is currently running on a
 -       * (different) CPU.
 -       *
 -       * The rationale is that if the lock owner is running, it is likely to
 -       * release the lock soon.
 +       * We try to spin for acquisition when we find that the lock owner
 +       * is currently running on a (different) CPU and while we don't
 +       * need to reschedule. The rationale is that if the lock owner is
 +       * running, it is likely to release the lock soon.
         *
         * Since this needs the lock owner, and this mutex implementation
         * doesn't track the owner atomically in the lock field, we need to
                if (owner && !mutex_spin_on_owner(lock, owner))
                        break;
  
 -              if ((atomic_read(&lock->count) == 1) &&
 +              /* Try to acquire the mutex if it is unlocked. */
 +              if (!mutex_is_locked(lock) &&
                    (atomic_cmpxchg(&lock->count, 1, 0) == 1)) {
                        lock_acquired(&lock->dep_map, ip);
                        if (use_ww_ctx) {
@@@ -478,11 -485,8 +478,11 @@@ slowpath
  #endif
        spin_lock_mutex(&lock->wait_lock, flags);
  
 -      /* once more, can we acquire the lock? */
 -      if (MUTEX_SHOW_NO_WAITER(lock) && (atomic_xchg(&lock->count, 0) == 1))
 +      /*
 +       * Once more, try to acquire the lock. Only try-lock the mutex if
 +       * it is unlocked to reduce unnecessary xchg() operations.
 +       */
 +      if (!mutex_is_locked(lock) && (atomic_xchg(&lock->count, 0) == 1))
                goto skip_wait;
  
        debug_mutex_lock_common(lock, &waiter);
                 * it's unlocked. Later on, if we sleep, this is the
                 * operation that gives us the lock. We xchg it to -1, so
                 * that when we release the lock, we properly wake up the
 -               * other waiters:
 +               * other waiters. We only attempt the xchg if the count is
 +               * non-negative in order to avoid unnecessary xchg operations:
                 */
 -              if (MUTEX_SHOW_NO_WAITER(lock) &&
 +              if (atomic_read(&lock->count) >= 0 &&
                    (atomic_xchg(&lock->count, -1) == 1))
                        break;
  
@@@ -820,10 -823,6 +820,10 @@@ static inline int __mutex_trylock_slowp
        unsigned long flags;
        int prev;
  
 +      /* No need to trylock if the mutex is locked. */
 +      if (mutex_is_locked(lock))
 +              return 0;
 +
        spin_lock_mutex(&lock->wait_lock, flags);
  
        prev = atomic_xchg(&lock->count, -1);
diff --combined lib/Kconfig.debug
index cf3b30dd0e0ad7ed2b503a028cacb9a39c2062e9,7a638aa3545bfa7d409dfa5110bc060acfd381a5..f488bef5ac373fec9a259395b6b1df2187ad8faf
@@@ -835,7 -835,7 +835,7 @@@ config DEBUG_RT_MUTEXE
  
  config RT_MUTEX_TESTER
        bool "Built-in scriptable tester for rt-mutexes"
 -      depends on DEBUG_KERNEL && RT_MUTEXES
 +      depends on DEBUG_KERNEL && RT_MUTEXES && BROKEN
        help
          This option enables a rt-mutex tester.
  
@@@ -930,7 -930,7 +930,7 @@@ config LOCKDE
        bool
        depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
        select STACKTRACE
-       select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC
+       select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE
        select KALLSYMS
        select KALLSYMS_ALL
  
@@@ -1408,7 -1408,7 +1408,7 @@@ config FAULT_INJECTION_STACKTRACE_FILTE
        depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
        depends on !X86_64
        select STACKTRACE
-       select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC
+       select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE
        help
          Provide stacktrace filter for fault-injection capabilities
  
This page took 0.120233 seconds and 4 git commands to generate.