SELinux: remove the unused ae.used

Previous thread: SELinux: convert the avc cache hash list to an hlist by Linux Kernel Mailing List on Thursday, March 26, 2009 - 12:01 pm. (1 message)

Next thread: SELinux: NULL terminate al contexts from disk by Linux Kernel Mailing List on Thursday, March 26, 2009 - 12:01 pm. (1 message)
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:01 pm

Gitweb:     http://git.kernel.org/linus/906d27d9d28fd50fb40026e56842d8f6806a7a04
Commit:     906d27d9d28fd50fb40026e56842d8f6806a7a04
Parent:     a5dda683328f99c781f92c66cc52ffc0639bef58
Author:     Eric Paris <eparis@redhat.com>
AuthorDate: Thu Feb 12 14:50:43 2009 -0500
Committer:  James Morris <jmorris@namei.org>
CommitDate: Sat Feb 14 09:22:37 2009 +1100

    SELinux: remove the unused ae.used
    
    Currently SELinux code has an atomic which was intended to track how many
    times an avc entry was used and to evict entries when they haven't been
    used recently.  Instead we never let this atomic get above 1 and evict when
    it is first checked for eviction since it hits zero.  This is a total waste
    of time so I'm completely dropping ae.used.
    
    This change resulted in about a 3% faster avc_has_perm_noaudit when running
    oprofile against a tbench benchmark.
    
    Signed-off-by: Eric Paris <eparis@redhat.com>
    Reviewed by: Paul Moore <paul.moore@hp.com>
    Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
    Signed-off-by: James Morris <jmorris@namei.org>
---
 security/selinux/avc.c |   28 +++++++---------------------
 1 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 0d00f48..0afb990 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -88,7 +88,6 @@ struct avc_entry {
 	u32			tsid;
 	u16			tclass;
 	struct av_decision	avd;
-	atomic_t		used;	/* used recently */
 };
 
 struct avc_node {
@@ -316,16 +315,13 @@ static inline int avc_reclaim_node(void)
 
 		rcu_read_lock();
 		list_for_each_entry(node, &avc_cache.slots[hvalue], list) {
-			if (atomic_dec_and_test(&node->ae.used)) {
-				/* Recently Unused */
-				avc_node_delete(node);
-				avc_cache_stats_incr(reclaims);
-				ecx++;
-				if (ecx >= AVC_CACHE_RECLAIM) {
-					rcu_read_unlock();
-					spin_unlock_irqrestore(&avc_cache.slots_lock[hvalue], flags);
-					goto ...
Previous thread: SELinux: convert the avc cache hash list to an hlist by Linux Kernel Mailing List on Thursday, March 26, 2009 - 12:01 pm. (1 message)

Next thread: SELinux: NULL terminate al contexts from disk by Linux Kernel Mailing List on Thursday, March 26, 2009 - 12:01 pm. (1 message)