selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] selinux: speed up avc_search_node() with large number of avc nodes
@ 2025-09-26  6:23 Hongru Zhang
  2025-09-26  6:23 ` [PATCH v3 1/2] selinux: Make avc cache slot size configurable during boot Hongru Zhang
  2025-09-26  6:23 ` [PATCH v3 2/2] selinux: improve bucket distribution uniformity of avc_hash() Hongru Zhang
  0 siblings, 2 replies; 16+ messages in thread
From: Hongru Zhang @ 2025-09-26  6:23 UTC (permalink / raw)
  To: stephen.smalley.work, paul, omosnace; +Cc: linux-kernel, selinux, zhanghongru

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 v3 of the patch series.
Changes since v2:
- update changelog and fix warnings for commit ("000bce8f11d0
  selinux: improve bucket distribution uniformity of avc_hash()")
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/
v2 discussion:
https://lore.kernel.org/selinux/cover.1758633723.git.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                        | 83 ++++++++++++++-----
 2 files changed, 65 insertions(+), 22 deletions(-)


base-commit: 68e1e908cb7682db9fb7f79907f9352435a81c0f
-- 
2.43.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-10-22  2:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26  6:23 [PATCH v3 0/2] selinux: speed up avc_search_node() with large number of avc nodes Hongru Zhang
2025-09-26  6:23 ` [PATCH v3 1/2] selinux: Make avc cache slot size configurable during boot Hongru Zhang
2025-09-26 12:19   ` Stephen Smalley
2025-10-16 21:18   ` Paul Moore
2025-10-17  8:10     ` Hongru Zhang
2025-10-20 19:12       ` Paul Moore
2025-10-21 12:38         ` Hongru Zhang
2025-10-21 15:44           ` Paul Moore
2025-10-22  2:49             ` Hongru Zhang
2025-10-17 11:59     ` Stephen Smalley
2025-10-20 19:22       ` Paul Moore
2025-09-26  6:23 ` [PATCH v3 2/2] selinux: improve bucket distribution uniformity of avc_hash() Hongru Zhang
2025-09-26 12:26   ` Stephen Smalley
2025-10-16 21:18   ` Paul Moore
2025-10-17  9:53     ` Hongru Zhang
2025-10-20 19:44       ` Paul Moore

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