]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: do not build lockdep for Release build 40062/head
authorKefu Chai <kchai@redhat.com>
Fri, 12 Mar 2021 11:39:28 +0000 (19:39 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 13 Mar 2021 03:34:34 +0000 (11:34 +0800)
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 <kchai@redhat.com>
src/common/CMakeLists.txt
src/crimson/os/alienstore/CMakeLists.txt
src/test/common/CMakeLists.txt

index 0ec4b2edb7ebfe943e849e461064faf5a8266f4f..a8917aaf47b72daacfa92ff6c31a0a08776340bd 100644 (file)
@@ -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()
index bc143a289b5bd8d33b2db82f5431a4d3ae1bf447..882fe9439ec357d8467016daab186a02b958ce27 100644 (file)
@@ -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
   $<TARGET_OBJECTS:common_prioritycache_obj>)
 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()
index a7e64a7a247867a7e9785f51103f4ddc189830ff..39d3a664b3b13dd3bc49802c38442e0c169b3dba 100644 (file)
@@ -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