selinux: reorder inode_security_struct to increase objs/slab on 64bit
PATCH 1/1 selinux: reorder inode_security_struct to increase objs/slab on 64bit
reorder inode_security_struct to remove padding on 64 bit builds
size reduced from 72 to 64 bytes increasing objects per slab to 64.
---
This patch is against 2.6.26-r2 & boots successfully on my AMD64 desktop.
Richard
security/selinux/include/objsec.h +1 -1
@@ -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 {
James Morris
AppliedQuoted 5 lines · Richard Kennedy
reorder
inode_security_structto remove padding on 64 bit buildssize reduced from 72 to 64 bytes increasing objects per slab to 64.
Signed-off-by Richard Kennedy <[email protected]>
Thanks, applied togit://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
Signature · 2 lines
James Morris <[email protected]>
Quoted 8 lines · James Morris
Quoted 5 lines · Richard Kennedy
reorder
inode_security_structto remove padding on 64 bit buildssize reduced from 72 to 64 bytes increasing objects per slab to 64.
Signed-off-by Richard Kennedy <[email protected]>
Quoted 7 lines
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
Quoted 20 lines · Richard Kennedy
reorder
inode_security_structto remove padding on 64 bit buildssize reduced from 72 to 64 bytes increasing objects per slab to 64.
Signed-off-by Richard Kennedy <[email protected]>---
This patch is against 2.6.26-r2 & boots successfully on my AMD64 desktop.Richard
security/selinux/include/objsec.h +0
-0
security/selinux/include/objsec.h struct inode_security_struct { · line 46
Quoted 5 lines
security/selinux/include/objsec.h +0
-1@@ -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.
Quoted 5 lines
security/selinux/include/objsec.h +1
-0+struct mutex lock; };struct file_security_struct {
Signature · 2 lines
Stephen Smalley National Security Agency
Quoted 7 lines · Stephen Smalley
security/selinux/include/objsec.h struct inode_security_struct { · line 46
Quoted 5 lines
security/selinux/include/objsec.h +0
-1u32 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 ingit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-akpm
Signature · 1 line
James Morris <[email protected]>