[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5364449d2011c1d394a7bb30109b923d@paul-moore.com>
Date: Thu, 23 Oct 2025 18:24:24 -0400
From: Paul Moore <paul@...l-moore.com>
To: Hongru Zhang <zhanghongru06@...il.com>, stephen.smalley.work@...il.com, omosnace@...hat.com
Cc: linux-kernel@...r.kernel.org, selinux@...r.kernel.org, zhanghongru@...omi.com
Subject: Re: [PATCH v4 1/3] selinux: Introduce a new config to make avc cache slot size adjustable
On Oct 23, 2025 Hongru Zhang <zhanghongru06@...il.com> wrote:
>
> 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.
>
> An actual call stack is as follows:
> => avc_compute_av
> => avc_perm_nonode
> => avc_has_perm_noaudit
> => selinux_capable
> => security_capable
> => capable
> => __sched_setscheduler
> => do_sched_setscheduler
> => __arm64_sys_sched_setscheduler
> => invoke_syscall
> => el0_svc_common
> => do_el0_svc
> => el0_svc
> => el0t_64_sync_handler
> => el0t_64_sync
>
> 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.
>
> So introduce a new config to make avc cache slot size also configurable,
> and with fine tuning, we can mitigate long time irqs off with slightly
> avc_search_node() performance regression.
>
> Theoretically, the main overhead is memory consumption.
>
> Signed-off-by: Hongru Zhang <zhanghongru@...omi.com>
> ---
> security/selinux/Kconfig | 11 +++++++++++
> security/selinux/avc.c | 6 +++---
> 2 files changed, 14 insertions(+), 3 deletions(-)
Merged into selinux/dev, thanks!
--
paul-moore.com
Powered by blists - more mailing lists