[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEjxPJ7Js6TJg3=uadoFc_P73-SVG2=0cQ1d5UpC9qOHdreR-g@mail.gmail.com>
Date: Fri, 8 Sep 2023 14:46:28 -0400
From: Stephen Smalley <stephen.smalley.work@...il.com>
To: Christian Göttsche <cgzones@...glemail.com>
Cc: selinux@...r.kernel.org, Paul Moore <paul@...l-moore.com>,
Eric Paris <eparis@...isplace.org>,
Ondrej Mosnacek <omosnace@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/6] selinux: improve role transition hashing
On Fri, Aug 18, 2023 at 11:12 AM Christian Göttsche
<cgzones@...glemail.com> wrote:
>
> The number of buckets is calculated by performing a binary AND against
> the mask of the hash table, which is one less than its size (which is a
> power of two). This leads to all top bits being discarded, e.g. with
> the Reference Policy on Debian there exists 376 entries, leading to a
> size of 512, discarding the top 23 bits.
>
> Use jhash to improve the hash table utilization:
>
> # current
> roletr: 376 entries and 124/512 buckets used, longest chain length 8, sum of chain length^2 1496
>
> # patch
> roletr: 376 entries and 266/512 buckets used, longest chain length 4, sum of chain length^2 646
>
> Signed-off-by: Christian Göttsche <cgzones@...glemail.com>
Reviewed-by: Stephen Smalley <stephen.smalley.work@...il.com>
Powered by blists - more mailing lists