]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
lockdep: switch follows_bt vector member to std::map
authorXiubo Li <xiubli@redhat.com>
Fri, 12 Mar 2021 12:49:24 +0000 (20:49 +0800)
committerXiubo Li <xiubli@redhat.com>
Fri, 12 Mar 2021 15:43:13 +0000 (23:43 +0800)
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 <xiubli@redhat.com>
src/common/lockdep.cc

index 59d42780a89508420c3f06b414bb6df7473b6dd9..241e2ea3c140c1d7cd02c94f9fb7eabae34baab1 100644 (file)
@@ -41,9 +41,8 @@ static constexpr size_t MAX_LOCKS = 128 * 1024;   // increase me as needed
 static std::bitset<MAX_LOCKS> free_ids; // bit set = free
 static ceph::unordered_map<pthread_t, std::map<int,ceph::BackTrace*> > held;
 static constexpr size_t NR_LOCKS = 4096; // the initial number of locks
-static constexpr size_t MAX_FOLLOWERS = 4096;
-static std::vector<std::bitset<MAX_FOLLOWERS>> follows(NR_LOCKS); // follows[a][b] means b taken after a
-static std::vector<std::array<ceph::BackTrace *, MAX_FOLLOWERS>> follows_bt(NR_LOCKS);
+static std::vector<std::bitset<MAX_LOCKS>> follows(NR_LOCKS); // follows[a][b] means b taken after a
+static std::vector<std::map<int,ceph::BackTrace *>> follows_bt(NR_LOCKS);
 // upper bound of lock id
 unsigned current_maxid;
 int last_freed_id = -1;