]> git.baikalelectronics.ru Git - kernel.git/commit
selinux: don't inline slow-path code into avc_has_perm_noaudit()
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 31 Mar 2012 17:58:08 +0000 (10:58 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 31 Mar 2012 18:24:22 +0000 (11:24 -0700)
commit27437a0d7adff48f8d9f237a9cc84a8fe167a6ed
treef84e38fa7a54c1a678a14d7a65e583efac1cafa3
parent5c54c6127fc433c8844c1a938bb1d3a005494190
selinux: don't inline slow-path code into avc_has_perm_noaudit()

The selinux AVC paths remain some of the hottest (and deepest) codepaths
at filename lookup time, and we make it worse by having the slow path
cases take up I$ and stack space even when they don't trigger.  Gcc
tends to always want to inline functions that are just called once -
never mind that this might make for slower and worse code in the caller.

So this tries to improve on it a bit by making the slow-path cases
explicitly separate functions that are marked noinline, causing gcc to
at least no longer allocate stack space for them unless they are
actually called.  It also seems to help register allocation a tiny bit,
since gcc now doesn't take the slow case code into account.

Uninlining the slow path may also allow us to inline the remaining hot
path into the one caller that actually matters: avc_has_perm_flags().
I'll have to look at that separately, but both avc_audit() and
avc_has_perm_noaudit() are now small and lean enough that inlining them
may make sense.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
security/selinux/avc.c