Skip to content

avtab hotspot optimizations

Jacob Satterfield selinux 1 version Applied

Status from this message: Merged into selinux/next, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 8 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3selinux: use arrays for avtab hashtable nodessecurity/selinux/ss/avtab.c security/selinux/ss/avtab.h security/selinux/ss/conditional.c +1 more+81 -555 replies
2/3selinux: shrink conditional avtab node arraysecurity/selinux/ss/avtab.c security/selinux/ss/avtab.h security/selinux/ss/conditional.c +1 more+84 -331 reply
3/3selinux: hweight optimization in avtab_read_itemsecurity/selinux/ss/avtab.c+2 -52 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchStephen Smalley
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] avtab hotspot optimizations

As the refpolicy and the default Fedora policy continue to grow in size, especially with regard to rules / access vectors, the memory usage of the policydb and runtime to search through it increases. Looking at /proc/slabinfo indicates that the avtab_node_cachep kmem_cache is significantly responsible for overall memory usage and was a good target for optimizations. Running "perf record" on the "load_policy" command shows that a majority of time is spent adding rules into the avtab.

This patch series is a first attempt at optimizing these hot spots within the security server implementation to help it scale with additional rules in the future.

Patches 1-2 deal specifically with the hashtable implementation within avtab and how memory is allocated for individual nodes.

Patch 3 is a runtime optimization discovered through profiling the "load_policy".

Jacob Satterfield (3):
selinux: use arrays for avtab hashtable nodes
selinux: shrink conditional avtab node array
selinux: hweight optimization in avtab_read_item

 security/selinux/ss/avtab.c       | 143 ++++++++++++++++++------------
 security/selinux/ss/avtab.h       |  36 ++++++--
 security/selinux/ss/conditional.c |  57 +++++++-----
 security/selinux/ss/conditional.h |   2 +-
 security/selinux/ss/services.c    |  20 +++--
 5 files changed, 166 insertions(+), 92 deletions(-)
Signature · 1 line
2.41.0