spinlock: use local_irq_disable() instead of local_irq_save() where possible
authorJan Beulich <jbeulich@suse.com>
Fri, 9 Jan 2015 16:30:32 +0000 (17:30 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 9 Jan 2015 16:30:32 +0000 (17:30 +0100)
... as generally being a cheaper operation.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/spinlock.c

index f9f19a88cb70a53e1640ac6f5cfcf6d737ccde1c..13340a3f61cfccc4d469ff1c1c79156b0304e6fd 100644 (file)
@@ -162,7 +162,7 @@ unsigned long _spin_lock_irqsave(spinlock_t *lock)
         local_irq_restore(flags);
         while ( likely(_raw_spin_is_locked(&lock->raw)) )
             cpu_relax();
-        local_irq_save(flags);
+        local_irq_disable();
     }
     LOCK_PROFILE_GOT;
     preempt_disable();
@@ -313,7 +313,7 @@ unsigned long _read_lock_irqsave(rwlock_t *lock)
             local_irq_restore(flags);
             while ( (x = lock->lock) & RW_WRITE_FLAG )
                 cpu_relax();
-            local_irq_save(flags);
+            local_irq_disable();
         }
     } while ( cmpxchg(&lock->lock, x, x+1) != x );
     preempt_disable();
@@ -409,7 +409,7 @@ unsigned long _write_lock_irqsave(rwlock_t *lock)
             local_irq_restore(flags);
             while ( (x = lock->lock) & RW_WRITE_FLAG )
                 cpu_relax();
-            local_irq_save(flags);
+            local_irq_disable();
         }
     } while ( cmpxchg(&lock->lock, x, x|RW_WRITE_FLAG) != x );
     while ( x != 0 )