]> git.hungrycats.org Git - linux/commit
[PATCH] Reduce SELinux kernel memory use on 64-bit systems
authorJames Morris <jmorris@redhat.com>
Tue, 24 Aug 2004 04:40:38 +0000 (21:40 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 24 Aug 2004 04:40:38 +0000 (21:40 -0700)
commit7c830b4a543afc6500f05df388e40fb5d9a96691
tree44d9a4a1c979bc87e4cacfde8f232ac10718aaac
parent0f1af7ba56b3d9475b2d365624bdc6108fde9b9f
[PATCH] Reduce SELinux kernel memory use on 64-bit systems

The patch below reduces kernel memory used by SELinux policy rules by about
37% on 64-bit systems.  This is because the size of struct avtab_node is 40
bytes on 64-bit, and defaults to a size-64 slab.

Creating a slab cache specifically for these structs saves considerable
amounts of kernel memory on 64-bit systems with large rulesets.  'Strict'
policy has over 300k rules, while 'targeted' policy has around 3k rules.

Here's the slabtop output with 64 and 40 byte sized slabs to show the
memory savings, for strict policy:

303475 303447  99%    0.06K   4975       61     19900K avtab_node
303456 303447  99%    0.04K   3161       96     12644K avtab_node

Also, there are 57% more objects per slab.

Signed-off-by: James Morris <jmorris@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
security/selinux/ss/avtab.c
security/selinux/ss/avtab.h
security/selinux/ss/services.c