aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2023-07-10 10:14:00 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-07-14 15:12:03 -0300
commit37e3bf08e0314efa08ba88600f07adf0079c987d (patch)
treed3c046ab6a35818961e7e41200841cdb8affbe2e
parentd65499a8605c224b1f6f6cc53f7c3d1d44d60542 (diff)
downloaddwarves-37e3bf08e0314efa08ba88600f07adf0079c987d.tar.gz
pahole: Don't keep structs in multiple RB trees
When resorting we were leaving structures in the structures__tree RB tree while adding them from structures_list to a resorted RB tree to then print them when --sort was used. When using DEBUG_CHECK_LEAKS we would traverse structures__tree to free all the structures, something not done by default to speed up tool exit. Stop using a new 'resorted' tree and instead initialize structures__tree to then reuse it to do the sorting. Reported-by: Eduard Zingerman <eddyz87@gmail.com> Co-developed-by: Eduard Zingerman <eddyz87@gmail.com> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Mykola Lysenko <mykolal@fb.com> Cc: Yonghong Song <yhs@fb.com> Cc: bpf@vger.kernel.org Cc: kernel-team@fb.com Link: https://lore.kernel.org/dwarves/20230525235949.2978377-1-eddyz87@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--pahole.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pahole.c b/pahole.c
index 6fc4ed6..e843999 100644
--- a/pahole.c
+++ b/pahole.c
@@ -673,10 +673,10 @@ static void print_ordered_classes(void)
if (!need_resort) {
__print_ordered_classes(&structures__tree);
} else {
- struct rb_root resorted = RB_ROOT;
+ structures__tree = RB_ROOT;
- resort_classes(&resorted, &structures__list);
- __print_ordered_classes(&resorted);
+ resort_classes(&structures__tree, &structures__list);
+ __print_ordered_classes(&structures__tree);
}
}