On Jan 12, 2015, at 10:47 AM, Stephen Smalley <sds@xxxxxxxxxxxxx> wrote:
Good catch. It looks like this is caused by the segment I highlighted above, removing the shift adjustment.
changed-nslot.txt:rules: 100967 entries and 68321/131072 buckets used, longest chain length 8
original-nslot.txt:rules: 100967 entries and 31017/32768 buckets used, longest chain length 13
So, one bucket is allocated per 2-4 elements. The change I actually wanted to make is to the definition of MAX_AVTAB_SIZE: it should be 2x MAX_AVTAB_HASH_BUCKETS to allow allocating a hash with maximum buckets, and that nslot bounding should use MAX_AVTAB_HASH_BUCKETS.
Interesting. I wonder what the kernel hash eval looks like - it might benefit from a better hash function as well.
Yeah; I expect there is a lot of room for algorithmic improvement here. I wish I had time to understand and fix it. We could probably get this running on the order of seconds instead of minutes, and using _much_ less memory.
Even after these patches, expand_module spends 60% in avtab_search_node (and 13% malloc_consolidate, the rest is trivial). Next step would be to reduce the number of elements or lookups.
One interesting note: this fully expanded table is built twice under expand_module, for hierarchy_check_constraints and check_assertions. We could cut runtime almost in half by reusing the table.
|
_______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.