Right now, hashtab_search() and hashtab_insert() are defined in hashtab.c and need to call functions indirectly via function pointers. It turns out that defining (the relevent parts of) these functions inline in the header and passing the function pointers as arguments makes them significantly faster. The first patch modifies the hashtab interface so that callbacks are always passed directly. The second patch finishes the job by moving some of the function definitions to the header.These could be also just one patch, but are kept separate for easier review of changes in the functions that are being moved around. For more details, please refer to the respective patch descriptions. Changes in v4: - drop patch 1 which is now applied - add ACK from Stephen to the last patch - use policydb_filenametr_search() in filename_trans_read_helper_compat() Changes in v3: - add perf numbers for two more use cases positively affected: policy load and MCS relabeling - drop inlining of hashtab_map() (perf-testing that change alone showed zero difference in both policy load and relabeling time) - reword the commit message of patch 2 I intended to refactor the code to hide the awkward hashtab funcions away, but it turned out the result would be even more messy than the current version, so I left the other code unchanged from v2. I do believe the performance gain is worth making the hashtab interface more low-level. Changes in v2: - drop already applied v1 patches 1 and 2 - reword patch descriptions to better explain what is going on and why - split out some of the symtab changes into a separate patch - tweak the signature and argument names of symtab_insert() Ondrej Mosnacek (2): selinux: prepare for inlining of hashtab functions selinux: complete the inlining of hashtab functions security/selinux/ss/hashtab.c | 59 +++----------------------- security/selinux/ss/hashtab.h | 77 ++++++++++++++++++++++++++++------ security/selinux/ss/mls.c | 2 +- security/selinux/ss/policydb.c | 76 +++++++++++++++++++++++---------- security/selinux/ss/policydb.h | 9 ++++ security/selinux/ss/services.c | 4 +- security/selinux/ss/symtab.c | 16 ++++--- 7 files changed, 147 insertions(+), 96 deletions(-) -- 2.26.2