From: Kefu Chai Date: Fri, 12 Mar 2021 11:39:28 +0000 (+0800) Subject: cmake: do not build lockdep for Release build X-Git-Tag: v17.1.0~2626^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=20e3ee4adaf8231d9f834450aad18c567d7aa277;p=ceph.git cmake: do not build lockdep for Release build lockdep create large data structures on .bss and on heap for tracking the locks and their dependencies. but we don't need to pay for this if lockdep is not enabled. lockdep helps us to track the lock dependencies related issue on Debug build. and Release build, this feature hurts the performance and more importantly, lockdeps is a feature only kicks in when using the mutex_debug and friends. they are not used in Release build at all. so, after this change, lockdep is not built in Release build. and the static variables defined in lockdep.cc are not allocated anymore in Release build. Signed-off-by: Kefu Chai --- diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 0ec4b2edb7ebf..a8917aaf47b72 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -74,7 +74,6 @@ set(common_srcs hostname.cc ipaddr.cc iso_8601.cc - lockdep.cc mempool.cc mime.c numa.cc @@ -103,6 +102,7 @@ set(common_srcs if(WITH_CEPH_DEBUG_MUTEX) list(APPEND common_srcs + lockdep.cc mutex_debug.cc shared_mutex_debug.cc) endif() diff --git a/src/crimson/os/alienstore/CMakeLists.txt b/src/crimson/os/alienstore/CMakeLists.txt index bc143a289b5bd..882fe9439ec35 100644 --- a/src/crimson/os/alienstore/CMakeLists.txt +++ b/src/crimson/os/alienstore/CMakeLists.txt @@ -15,7 +15,6 @@ set(crimson_alien_common_srcs ${PROJECT_SOURCE_DIR}/src/common/Finisher.cc ${PROJECT_SOURCE_DIR}/src/common/HeartbeatMap.cc ${PROJECT_SOURCE_DIR}/src/common/PluginRegistry.cc - ${PROJECT_SOURCE_DIR}/src/common/lockdep.cc ${PROJECT_SOURCE_DIR}/src/common/perf_counters.cc ${PROJECT_SOURCE_DIR}/src/common/perf_counters_collection.cc ${PROJECT_SOURCE_DIR}/src/common/RefCountedObj.cc @@ -31,6 +30,7 @@ set(crimson_alien_common_srcs $) if(WITH_CEPH_DEBUG_MUTEX) list(APPEND crimson_alien_common_srcs + ${PROJECT_SOURCE_DIR}/src/common/lockdep.cc ${PROJECT_SOURCE_DIR}/src/common/mutex_debug.cc ${PROJECT_SOURCE_DIR}/src/common/shared_mutex_debug.cc) endif() diff --git a/src/test/common/CMakeLists.txt b/src/test/common/CMakeLists.txt index a7e64a7a24786..39d3a664b3b13 100644 --- a/src/test/common/CMakeLists.txt +++ b/src/test/common/CMakeLists.txt @@ -25,10 +25,12 @@ if(HAVE_BLKID AND LINUX) endif() # unittest_lockdep -add_executable(unittest_lockdep - test_lockdep.cc) -add_ceph_unittest(unittest_lockdep) -target_link_libraries(unittest_lockdep ceph-common) +if(WITH_CEPH_DEBUG_MUTEX) + add_executable(unittest_lockdep + test_lockdep.cc) + add_ceph_unittest(unittest_lockdep) + target_link_libraries(unittest_lockdep ceph-common) +endif() # unittest_counter add_executable(unittest_counter