[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFqZXNsfq+JbTtEZtk-2NO8ciGLFy+n3hNP6HX9hTDOdCit5hA@mail.gmail.com>
Date: Wed, 12 Feb 2020 12:40:07 +0100
From: Ondrej Mosnacek <omosnace@...hat.com>
To: Lucas Stach <dev@...xeye.de>
Cc: Paul Moore <paul@...l-moore.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
Eric Paris <eparis@...isplace.org>,
SElinux list <selinux@...r.kernel.org>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>,
Richard Haines <richard_c_haines@...nternet.com>
Subject: Re: [PATCH RFC] selinux: policydb - convert filename trans hash to rhashtable
Hi Lucas,
On Thu, Jan 16, 2020 at 10:48 PM Lucas Stach <dev@...xeye.de> wrote:
> The current hash is too small for current usages in, e.g. the Fedora standard
> policy. On file creates a considerable amount of CPU time is spent walking the
> the hash chains. Increasing the number of hash buckets somewhat mitigates the
> issue, but doesn't completely get rid of the long hash chains.
>
> This patch does take the bit more invasive route by converting the filename
> trans hash to a rhashtable to allow this hash to scale with load.
>
> fs_mark create benchmark on a SSD device, no ramdisk:
> Count Size Files/sec App Overhead
> before:
> 10000 512 512.3 147715
> after:
> 10000 512 572.3 75141
>
> filenametr_cmp(), which was the topmost function in the CPU cycle trace before
> at ~5% of the overall CPU time, is now down in the noise.
>
> Signed-off-by: Lucas Stach <dev@...xeye.de>
> ---
> security/selinux/ss/policydb.c | 140 +++++++++++++++++++++++----------
> security/selinux/ss/policydb.h | 14 ++--
> security/selinux/ss/services.c | 31 +-------
> 3 files changed, 109 insertions(+), 76 deletions(-)
>
FYI, I posted a related patch series [1] that should have a similar
effect on the file create performance, plus it also reduces memory
taken up by the file transition rules. It would be great if you could
test it vs. your (fixed) patch to see if it works for you.
Thanks!
[1] https://lore.kernel.org/selinux/20200212112255.105678-1-omosnace@redhat.com/T/
--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.
Powered by blists - more mailing lists