From a873edba9e009ec34150ac5f6cd5ce9fa0dd5719 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Fri, 12 Mar 2021 20:49:24 +0800 Subject: [PATCH] lockdep: switch follows_bt vector member to std::map Delete the MAX_FOLLOWERS and increase the bitset size to MAX_LOCKS in 'follows'. The maximum memories of the 'follows' will be 2GB. But for the 'follows_bt', if we continue use the std::array, the maximum memories will be 128G, but most of the array spaces are useless. Switch the std::array to std::man instead. Signed-off-by: Xiubo Li --- src/common/lockdep.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/common/lockdep.cc b/src/common/lockdep.cc index 59d42780a89..241e2ea3c14 100644 --- a/src/common/lockdep.cc +++ b/src/common/lockdep.cc @@ -41,9 +41,8 @@ static constexpr size_t MAX_LOCKS = 128 * 1024; // increase me as needed static std::bitset free_ids; // bit set = free static ceph::unordered_map > held; static constexpr size_t NR_LOCKS = 4096; // the initial number of locks -static constexpr size_t MAX_FOLLOWERS = 4096; -static std::vector> follows(NR_LOCKS); // follows[a][b] means b taken after a -static std::vector> follows_bt(NR_LOCKS); +static std::vector> follows(NR_LOCKS); // follows[a][b] means b taken after a +static std::vector> follows_bt(NR_LOCKS); // upper bound of lock id unsigned current_maxid; int last_freed_id = -1; -- 2.47.3