[RFC][PATCH 13/16] objtool: Delete cleanup()
From: Peter Zijlstra
Date: Thu Mar 12 2020 - 09:52:12 EST
Perf shows we spend a measurable amount of time spend cleaning up
right before we exit anyway. Avoid the needsless work and just
terminate.
This reduces objtool on vmlinux.o runtime from 5.4s to 4.8s
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
tools/objtool/check.c | 19 -------------------
1 file changed, 19 deletions(-)
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2520,23 +2520,6 @@ static int validate_reachable_instructio
return 0;
}
-static void cleanup(struct objtool_file *file)
-{
- struct instruction *insn, *tmpinsn;
- struct alternative *alt, *tmpalt;
-
- list_for_each_entry_safe(insn, tmpinsn, &file->insn_list, list) {
- list_for_each_entry_safe(alt, tmpalt, &insn->alts, list) {
- list_del(&alt->list);
- free(alt);
- }
- list_del(&insn->list);
- hash_del(&insn->hash);
- free(insn);
- }
- elf_close(file->elf);
-}
-
static struct objtool_file file;
int check(const char *_objname, bool orc)
@@ -2613,8 +2596,6 @@ int check(const char *_objname, bool orc
}
out:
- cleanup(&file);
-
/* ignore warnings for now until we get all the code cleaned up */
if (ret || warnings)
return 0;