diff options
author | Qiuxu Zhuo <qiuxu.zhuo@intel.com> | 2020-09-22 16:47:18 +0800 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2020-09-23 17:39:24 -0700 |
commit | 2e923ddb0b39726f913ca929219ff5c477646e36 (patch) | |
tree | 79243467a0c06d709f013e637d6f2d336debf33c | |
parent | 2a9e4d5749026cd4be236397c3f2aa7bd204e61b (diff) | |
download | mcelog-2e923ddb0b39726f913ca929219ff5c477646e36.tar.gz |
mcelog: Rebalance the red-black tree after inserting a new nodev173
The original mcelog code rebalances the red-black tree after
finding an existed node, but doesn't rebalance the red-black
tree after inserting a new node for counting correctable
errors for a new page. This is incorrect.
Fix it by only rebalancing the red-black tree after inserting
a new node.
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r-- | page.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -100,6 +100,7 @@ mempage_insert_lookup(u64 addr, struct rb_node * node) return mp; } rb_link_node(node, parent, p); + rb_insert_color(node, &mempage_root); return NULL; } @@ -107,8 +108,6 @@ static struct mempage *mempage_insert(u64 addr, struct mempage *mp) { mp->addr = addr; mp = mempage_insert_lookup(addr, &mp->nd); - if (mp != NULL) - rb_insert_color(&mp->nd, &mempage_root); return mp; } |