提交 87ecb582 编写于 作者: P Peter Zijlstra 提交者: Ingo Molnar

objtool: Use sec_offset_hash() for insn_hash

In preparation for find_insn_containing(), change insn_hash to use
sec_offset_hash().

This actually reduces runtime; probably because mixing in the section
index reduces the collisions due to text sections all starting their
instructions at offset 0.

Runtime on vmlinux.o from 3.1 to 2.5 seconds.
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: NMiroslav Benes <mbenes@suse.cz>
Reviewed-by: NAlexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: NJosh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20200416115119.227240432@infradead.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 34f7c96d
......@@ -34,9 +34,10 @@ struct instruction *find_insn(struct objtool_file *file,
{
struct instruction *insn;
hash_for_each_possible(file->insn_hash, insn, hash, offset)
hash_for_each_possible(file->insn_hash, insn, hash, sec_offset_hash(sec, offset)) {
if (insn->sec == sec && insn->offset == offset)
return insn;
}
return NULL;
}
......@@ -282,7 +283,7 @@ static int decode_instructions(struct objtool_file *file)
if (ret)
goto err;
hash_add(file->insn_hash, &insn->hash, insn->offset);
hash_add(file->insn_hash, &insn->hash, sec_offset_hash(sec, insn->offset));
list_add_tail(&insn->list, &file->insn_list);
nr_insns++;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册