lkml.org 
[lkml]   [2023]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [GIT PULL] selinux/selinux-pr-20231030
On Mon, 30 Oct 2023 at 16:16, Paul Moore <paul@paul-moore.com> wrote:
>
> * Use a better hashing function for the SELinux role tansition hash
> table.

Bah.

While the old hash function was garbage, the new one is quite expensive.

Maybe it's worth it.

But generally, if you find that "oh, just doing a modulus with a power
of two drops all high bits", the first thing to try is probably to
just do "hash_long(x, N)" to get N bits instead.

Assuming the input is somewhat ok in one word, it does a fairly good
job of mixing the bits with a simple multiply-and-shift.

Yes, yes, jhash is a fine hash, but it does a quite *lot* of (simple)
ALU ops. While "hash_long()" is often small enough to be inlined.

I also note that filenametr_hash() does the old "one byte at a time"
hash and partial_name_hash(). Is there any reason that code doesn't
use the "full_name_hash()" which does things a word at a time?

Probably doesn't matter, but since I looked at this to see what the
new hashing was, I noticed...

Linus

\
 
 \ /
  Last update: 2023-10-31 07:14    [W:0.058 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site