From: Hongru Zhang <zhanghongru06@gmail.com>
To: paul@paul-moore.com, stephen.smalley.work@gmail.com, omosnace@redhat.com
Cc: linux-kernel@vger.kernel.org, selinux@vger.kernel.org,
zhanghongru@xiaomi.com
Subject: [PATCH v2 0/2] selinux: speed up avc_search_node() with large number of avc nodes
Date: Wed, 24 Sep 2025 10:55:19 +0800 [thread overview]
Message-ID: <cover.1758633723.git.zhanghongru@xiaomi.com> (raw)
On mobile device high-load situations, permission check can happen
more than 90,000/s (8 core system). With default 512 cache nodes
configuration, avc cache miss happens more often and occasionally
leads to long time (>2ms) irqs off on both big and little cores,
which decreases system real-time capability.
Although we can expand avc nodes through /sys/fs/selinux/cache_threshold
to mitigate long time irqs off, hash conflicts make the bucket average
length longer because of the fixed size of cache slots, leading to
avc_search_node() latency increase.
This patch series aims to expand AVC nodes without significantly increasing
avc_search_node() latency.
This is v2 of the patch series, addressing feedback from v1.
Changes since v1:
- improve hash algorithm in avc_hash()
- define avc_cache_slots as a static variable
v1 discussion:
https://lore.kernel.org/selinux/20250905100454.685866-1-zhanghongru@xiaomi.com/
--
Hongru Zhang (2):
selinux: Make avc cache slot size configurable during boot
selinux: improve bucket distribution uniformity of avc_hash()
.../admin-guide/kernel-parameters.txt | 4 +
security/selinux/avc.c | 82 ++++++++++++++-----
2 files changed, 64 insertions(+), 22 deletions(-)
base-commit: 68e1e908cb7682db9fb7f79907f9352435a81c0f
--
2.43.0
next reply other threads:[~2025-09-24 2:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 2:55 Hongru Zhang [this message]
2025-09-24 2:55 ` [PATCH v2 1/2] selinux: Make avc cache slot size configurable during boot Hongru Zhang
2025-09-24 2:55 ` [PATCH v2 2/2] selinux: improve bucket distribution uniformity of avc_hash() Hongru Zhang
2025-09-25 12:51 ` Stephen Smalley
2025-09-25 13:17 ` Hongru Zhang
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=cover.1758633723.git.zhanghongru@xiaomi.com \
--to=zhanghongru06@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
--cc=zhanghongru@xiaomi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).