2020-03-24 16:14:58

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH v3 15/26] objtool: Delete cleanup()

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) <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
---
tools/objtool/check.c | 19 -------------------
1 file changed, 19 deletions(-)

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2476,23 +2476,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)
@@ -2560,8 +2543,6 @@ int check(const char *_objname, bool orc
}

out:
- cleanup(&file);
-
if (ret < 0) {
/*
* Fatal error. The binary is corrupt or otherwise broken in



2020-03-25 12:12:20

by Miroslav Benes

[permalink] [raw]
Subject: Re: [PATCH v3 15/26] objtool: Delete cleanup()

On Tue, 24 Mar 2020, Peter Zijlstra wrote:

> 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) <[email protected]>
> Acked-by: Josh Poimboeuf <[email protected]>

Reviewed-by: Miroslav Benes <[email protected]>

M

Subject: [tip: core/objtool] objtool: Delete cleanup()

The following commit has been merged into the core/objtool branch of tip:

Commit-ID: 8887a86eddd93ca396ca35f7b41fb14ed412f85d
Gitweb: https://git.kernel.org/tip/8887a86eddd93ca396ca35f7b41fb14ed412f85d
Author: Peter Zijlstra <[email protected]>
AuthorDate: Wed, 11 Mar 2020 23:07:42 +01:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Wed, 25 Mar 2020 18:28:30 +01:00

objtool: Delete cleanup()

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) <[email protected]>
Reviewed-by: Miroslav Benes <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
tools/objtool/check.c | 19 -------------------
1 file changed, 19 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 54a6043..0c9c9ad 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -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)
@@ -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