lkml.org 
[lkml]   [2005]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 4/5: LSM hooks rework
From: Kurt Garloff <garloff@suse.de>
Subject: Consider the capability case the likely one
References: 40217, 39439

The case that security_ops points to the default capability_
security_ops is the fast path and arguably the more likely one
on most systems. So mark it likely to tell the compiler to
optimize accordingly and increase the chances of having this
predicted correctly by the CPU.

This is patch 4/5 of the LSM overhaul.

security.h | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

Signed-off-by: Kurt Garloff <garloff@suse.de>

Index: linux-2.6.10/include/linux/security.h
===================================================================
--- linux-2.6.10.orig/include/linux/security.h
+++ linux-2.6.10/include/linux/security.h
@@ -1253,9 +1253,9 @@ extern int mod_reg_security (const char
extern int mod_unreg_security (const char *name, struct security_operations *ops);

/* Condition for invocation of non-default security_op */
#define COND_SECURITY(seop, def) \
- (security_ops == &capability_security_ops)? def: security_ops->seop
+ (likely(security_ops == &capability_security_ops))? def: security_ops->seop

#else /* CONFIG_SECURITY */
static inline int security_init(void)
{
--
Kurt Garloff, Director SUSE Labs, Novell Inc.[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.075 / U:1.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site