mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selinux: reorder inode_security_struct to increase objs/slab on 64bit
@ 2008-05-18 11:32 Richard Kennedy
  2008-05-18 23:18 ` James Morris
  2008-05-19 11:39 ` Stephen Smalley
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Kennedy @ 2008-05-18 11:32 UTC (permalink / raw)
  To: sds, jmorris; +Cc: lkml

reorder inode_security_struct to remove padding on 64 bit builds
    
size reduced from 72 to 64 bytes increasing objects per slab to 64.
        
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>

---
This patch is against 2.6.26-r2 & boots successfully on my AMD64
desktop.


Richard



diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
index 032c235..5f0be19 100644
--- a/security/selinux/include/objsec.h
+++ b/security/selinux/include/objsec.h
@@ -43,8 +43,8 @@ struct inode_security_struct {
 	u32 sid;		/* SID of this object */
 	u16 sclass;		/* security class of this object */
 	unsigned char initialized;	/* initialization flag */
-	struct mutex lock;
 	unsigned char inherit;	/* inherit SID from parent entry */
+	struct mutex lock;
 };
 
 struct file_security_struct {



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

* Re: [PATCH] selinux: reorder inode_security_struct to increase objs/slab on 64bit
  2008-05-18 11:32 [PATCH] selinux: reorder inode_security_struct to increase objs/slab on 64bit Richard Kennedy
@ 2008-05-18 23:18 ` James Morris
  2008-05-19  8:21   ` Richard Kennedy
  2008-05-19 11:39 ` Stephen Smalley
  1 sibling, 1 reply; 5+ messages in thread
From: James Morris @ 2008-05-18 23:18 UTC (permalink / raw)
  To: Richard Kennedy; +Cc: sds, lkml

On Sun, 18 May 2008, Richard Kennedy wrote:

> reorder inode_security_struct to remove padding on 64 bit builds
>     
> size reduced from 72 to 64 bytes increasing objects per slab to 64.
>         
> Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>

Thanks, applied to 
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-akpm

(Although I see a reduction from 164 to 160 bytes).


- James
-- 
James Morris
<jmorris@namei.org>

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

* Re: [PATCH] selinux: reorder inode_security_struct to increase objs/slab on 64bit
  2008-05-18 23:18 ` James Morris
@ 2008-05-19  8:21   ` Richard Kennedy
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Kennedy @ 2008-05-19  8:21 UTC (permalink / raw)
  To: James Morris; +Cc: sds, lkml


On Mon, 2008-05-19 at 09:18 +1000, James Morris wrote: 
> On Sun, 18 May 2008, Richard Kennedy wrote:
> 
> > reorder inode_security_struct to remove padding on 64 bit builds
> >     
> > size reduced from 72 to 64 bytes increasing objects per slab to 64.
> >         
> > Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
> 
> Thanks, applied to 
> git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-akpm
> 
> (Although I see a reduction from 164 to 160 bytes).
> 
> 
> - James

In that case I think you've got all the lock & mutex debugging turned
on :)
CONFIG_DEBUG_MUTEXES & CONFIG_DEBUG_LOCK_ALLOC will add a lot to the
mutex directly.

CONFIG_GENERIC_LOCKBREAK, CONFIG_DEBUG_SPINLOCK &
CONFIG_DEBUG_LOCK_ALLOC will each grow the spinlock contained in the
mutex.

However, I'm seeing all structures packed to size of 8n -- so I'd never
get a sizeof 164. Maybe that's just a platform/compiler difference ?
I'm running on AMD 64 & gcc 4.1.2


Richard




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

* Re: [PATCH] selinux: reorder inode_security_struct to increase objs/slab on 64bit
  2008-05-18 11:32 [PATCH] selinux: reorder inode_security_struct to increase objs/slab on 64bit Richard Kennedy
  2008-05-18 23:18 ` James Morris
@ 2008-05-19 11:39 ` Stephen Smalley
  2008-05-20  0:01   ` James Morris
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2008-05-19 11:39 UTC (permalink / raw)
  To: Richard Kennedy; +Cc: jmorris, lkml


On Sun, 2008-05-18 at 12:32 +0100, Richard Kennedy wrote:
> reorder inode_security_struct to remove padding on 64 bit builds
>     
> size reduced from 72 to 64 bytes increasing objects per slab to 64.
>         
> Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
> 
> ---
> This patch is against 2.6.26-r2 & boots successfully on my AMD64
> desktop.
> 
> 
> Richard
> 
> 
> 
> diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
> index 032c235..5f0be19 100644
> --- a/security/selinux/include/objsec.h
> +++ b/security/selinux/include/objsec.h
> @@ -43,8 +43,8 @@ struct inode_security_struct {
>  	u32 sid;		/* SID of this object */
>  	u16 sclass;		/* security class of this object */
>  	unsigned char initialized;	/* initialization flag */
> -	struct mutex lock;
>  	unsigned char inherit;	/* inherit SID from parent entry */

Let's just drop inherit altogether - dead field.

> +	struct mutex lock;
>  };
>  
>  struct file_security_struct {
> 
-- 
Stephen Smalley
National Security Agency


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

* Re: [PATCH] selinux: reorder inode_security_struct to increase objs/slab on 64bit
  2008-05-19 11:39 ` Stephen Smalley
@ 2008-05-20  0:01   ` James Morris
  0 siblings, 0 replies; 5+ messages in thread
From: James Morris @ 2008-05-20  0:01 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: Richard Kennedy, lkml

On Mon, 19 May 2008, Stephen Smalley wrote:

> >  	u32 sid;		/* SID of this object */
> >  	u16 sclass;		/* security class of this object */
> >  	unsigned char initialized;	/* initialization flag */
> > -	struct mutex lock;
> >  	unsigned char inherit;	/* inherit SID from parent entry */
> 
> Let's just drop inherit altogether - dead field.

Done in 
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-akpm

-- 
James Morris <jmorris@namei.org>


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

end of thread, other threads:[~2008-05-20  0:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-18 11:32 [PATCH] selinux: reorder inode_security_struct to increase objs/slab on 64bit Richard Kennedy
2008-05-18 23:18 ` James Morris
2008-05-19  8:21   ` Richard Kennedy
2008-05-19 11:39 ` Stephen Smalley
2008-05-20  0:01   ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®