From f94f8efc61f135820d2c086e36422f19b932f20c Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 19 Nov 1999 22:47:19 +0000 Subject: [PATCH] Optimize two cases in the MP locking code. First, it is not necessary to use a locked cmpexg when unlocking a lock that we already hold, since nobody else can touch the lock while we hold it. Second, it is not necessary to use a locked cmpexg when locking a lock that we already hold, for the same reason. These changes will allow MP locks to be used recursively without impacting performance. Modify two procedures that are called only by assembly and are already NOPROF entries to pass a critical argument in %edx instead of on the stack, removing a significant amount of code from the critical path as a consequence. Reviewed by: Alfred Perlstein , Peter Wemm --- sys/i386/include/lock.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/i386/include/lock.h b/sys/i386/include/lock.h index 1faff8261b32..25c54e48f8cf 100644 --- a/sys/i386/include/lock.h +++ b/sys/i386/include/lock.h @@ -55,9 +55,8 @@ add $4, %esp #define ISR_RELLOCK \ - pushl $_mp_lock ; /* GIANT_LOCK */ \ - call _MPrellock ; \ - add $4, %esp + movl $_mp_lock,%edx ; /* GIANT_LOCK */ \ + call _MPrellock_edx /* * Protects the IO APIC and apic_imen as a critical region.