[PATCH] objtool: Remove redundant hash_init() of the instruction hash
From: Armaan Sandhu
Date: Mon Oct 05 2026 - 18:23:14 EST
objtool_open_read() calls hash_init() on file.insn_hash, a 2^20 bucket
(8 MiB) table in the static objtool_file. Static storage is already
zeroed and objtool_open_read() refuses to run twice, so the call only
writes zeroes over zeroes. It also faults in all 2048 pages of the
table on every run, even for a small module that uses a handful of
buckets.
Drop it. The table pages are now only faulted in when a bucket is used.
For a small module (xt_mark.o), objtool goes from 2.21 ms to 0.70 ms
and from 2189 to 210 page faults. Running objtool over all 4856 modules
of a Fedora 7.2.8 kernel (--module --dry-run) takes 17.3 s of CPU time
instead of 23.7 s (-27%), and 7.1M page faults instead of 12.4M.
The output is unchanged: vmlinux.o and all modules of an x86_64
defconfig build are byte-identical, and objtool reports the same
results for all 4856 Fedora modules.
Signed-off-by: Armaan Sandhu <armaan.sandhu0504@xxxxxxxxx>
---
tools/objtool/objtool.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c
index a4e139dee7e9..71e048f8582a 100644
--- a/tools/objtool/objtool.c
+++ b/tools/objtool/objtool.c
@@ -29,7 +29,6 @@ struct objtool_file *objtool_open_read(const char *filename)
if (!file.elf)
return NULL;
- hash_init(file.insn_hash);
INIT_LIST_HEAD(&file.retpoline_call_list);
INIT_LIST_HEAD(&file.return_thunk_list);
INIT_LIST_HEAD(&file.static_call_list);
--
2.55.0