All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Satterfield <jsatterfield.linux@gmail.com>
To: selinux@vger.kernel.org
Cc: Jacob Satterfield <jsatterfield.linux@gmail.com>,
	stephen.smalley.work@gmail.com, paul@paul-moore.com,
	omosnace@redhat.com
Subject: [PATCH 0/3] avtab hotspot optimizations
Date: Wed,  6 Sep 2023 15:46:03 +0000	[thread overview]
Message-ID: <20230906154611.31762-1-jsatterfield.linux@gmail.com> (raw)

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(-)

-- 
2.41.0


             reply	other threads:[~2023-09-06 15:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06 15:46 Jacob Satterfield [this message]
2023-09-06 15:46 ` [PATCH 1/3] selinux: use arrays for avtab hashtable nodes Jacob Satterfield
2023-09-06 17:16   ` Stephen Smalley
2023-09-13  3:23   ` Paul Moore
2023-09-14 21:57     ` Jacob Satterfield
2023-09-15  1:10       ` Paul Moore
2023-09-18  0:12         ` Jacob Satterfield
2023-09-06 15:46 ` [PATCH 2/3] selinux: shrink conditional avtab node array Jacob Satterfield
2023-09-06 17:17   ` Stephen Smalley
2023-09-06 15:46 ` [PATCH 3/3] selinux: hweight optimization in avtab_read_item Jacob Satterfield
2023-09-06 17:18   ` Stephen Smalley
2023-09-13 17:54   ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230906154611.31762-1-jsatterfield.linux@gmail.com \
    --to=jsatterfield.linux@gmail.com \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.