aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/trace-event-scripting.c
diff options
context:
space:
mode:
authorJacob Satterfield <[email protected]>2023-09-06 15:46:06 +0000
committerPaul Moore <[email protected]>2023-09-13 13:52:17 -0400
commit9d140885e35dac6dff2c56eccacc13f4fc96188a (patch)
treef8f766ad743b6ef106d76e7371e70d2c3efde84a /tools/perf/util/trace-event-scripting.c
parent37b7ea3ca3062f5b7f02c2b335f203e4d411793d (diff)
selinux: hweight optimization in avtab_read_item
avtab_read_item() is a hot function called when reading each rule in a binary policydb. With the current Fedora policy and refpolicy, this function is called nearly 100,000 times per policy load. A single avtab node is only permitted to have a single specifier to describe the data it holds. As such, a check is performed to make sure only one specifier is set. Previously this was done via a for-loop. However, there is already an optimal function for finding the number of bits set (hamming weight) and on some architectures, dedicated instructions (popcount) which can be executed much more efficiently. Even when using -mcpu=generic on a x86-64 Fedora 38 VM, this commit results in a modest 2-4% speedup for policy loading due to a substantial reduction in the number of instructions executed. Signed-off-by: Jacob Satterfield <[email protected]> Reviewed-by: Stephen Smalley <[email protected]> Signed-off-by: Paul Moore <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions