Skip to content

Commit

Permalink
objtool: Delete cleanup()
Browse files Browse the repository at this point in the history
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@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20200324160924.800720170@infradead.org
  • Loading branch information
Peter Zijlstra committed Mar 25, 2020
1 parent 8b5fa6b commit 8887a86
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions tools/objtool/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -2458,23 +2458,6 @@ static int validate_reachable_instructions(struct objtool_file *file)
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)
Expand Down Expand Up @@ -2542,8 +2525,6 @@ int check(const char *_objname, bool orc)
}

out:
cleanup(&file);

if (ret < 0) {
/*
* Fatal error. The binary is corrupt or otherwise broken in
Expand Down

0 comments on commit 8887a86

Please sign in to comment.