From e28af4a2fc2596502ab7d31bdd6d64a50abe6c5d Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 29 Jan 2022 01:47:18 +0200 Subject: Kernel: Stop using HashMap in Mutex This commit removes the usage of HashMap in Mutex, thereby making Mutex be allocation-free. In order to achieve this several simplifications were made to Mutex, removing unused code-paths and extra VERIFYs: * We no longer support 'upgrading' a shared lock holder to an exclusive holder when it is the only shared holder and it did not unlock the lock before relocking it as exclusive. NOTE: Unlike the rest of these changes, this scenario is not VERIFY-able in an allocation-free way, as a result the new LOCK_SHARED_UPGRADE_DEBUG debug flag was added, this flag lets Mutex allocate in order to detect such cases when debugging a deadlock. * We no longer support checking if a Mutex is locked by the current thread when the Mutex was not locked exclusively, the shared version of this check was not used anywhere. * We no longer support force unlocking/relocking a Mutex if the Mutex was not locked exclusively, the shared version of these functions was not used anywhere. --- Meta/CMake/all_the_debug_macros.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'Meta/CMake') diff --git a/Meta/CMake/all_the_debug_macros.cmake b/Meta/CMake/all_the_debug_macros.cmake index abb8b61613..4ff054c51c 100644 --- a/Meta/CMake/all_the_debug_macros.cmake +++ b/Meta/CMake/all_the_debug_macros.cmake @@ -106,6 +106,7 @@ set(LOCK_DEBUG ON) set(LOCK_IN_CRITICAL_DEBUG ON) set(LOCK_RANK_ENFORCEMENT ON) set(LOCK_RESTORE_DEBUG ON) +set(LOCK_SHARED_UPGRADE_DEBUG ON) set(LOCK_TRACE_DEBUG ON) set(LOOKUPSERVER_DEBUG ON) set(MALLOC_DEBUG ON) -- cgit v1.2.3