Merge PR #40070 into master

* refs/pull/40070/head:
	lockdep: fix follows/follows_bt resize() size
	lockdep: switch follows_bt vector member to std::map

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Xuehan Xu <xuxuehan@360.cn>
This commit is contained in:
Patrick Donnelly 2021-03-16 20:27:15 -07:00
commit 84801a0034
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
2 changed files with 5 additions and 5 deletions

View File

@ -134,3 +134,4 @@ ShyamsundarR Shyamsundar R <srangana@redhat.com>
sunnyku Sunny Kumar <sunkumar@redhat.com>
adk3798 Adam King <adking@redhat.com>
runsisi luo runbing <luo.runbing@zte.com.cn>
xxhdx1985126 Xuehan Xu <xuxuehan@360.cn>

View 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;
@ -173,8 +172,8 @@ static int _lockdep_register(const char *name)
if (current_maxid <= (unsigned)id) {
current_maxid = (unsigned)id + 1;
if (current_maxid == follows.size()) {
follows.resize(current_maxid);
follows_bt.resize(current_maxid);
follows.resize(current_maxid + 1);
follows_bt.resize(current_maxid + 1);
}
}
lock_ids[name] = id;