Security: smack: replace kzalloc with kmem_cache for inode_smack
authorjooseong.lee <jooseong.lee@samsung.com>
Wed, 25 Mar 2015 02:02:03 +0000 (11:02 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 25 Mar 2015 05:23:38 +0000 (14:23 +0900)
commit7b0efb9f06660a52a5c4408e98dcfa9ec7a22dfb
tree234627dada2253441bbdd0991743fc31d118e46e
parent6c04bd0bfa920697a17d64a3b0314e3fc9cf9597
Security: smack: replace kzalloc with kmem_cache for inode_smack

The patch use kmem_cache to allocate/free inode_smack since they are
alloced in high volumes making it a perfect case for kmem_cache.

As per analysis, 24 bytes of memory is wasted per allocation due
to internal fragmentation. With kmem_cache, this can be avoided.

Accounting of memory allocation is below :
 total       slack            net      count-alloc/free        caller
Before (with kzalloc)
1919872      719952          1919872      29998/0          new_inode_smack+0x14

After (with kmem_cache)
1201680          0           1201680      30042/0          new_inode_smack+0x18

>From above data, we found that 719952 bytes(~700 KB) of memory is
saved on allocation of 29998 smack inodes.

Change-Id: Ia930c48bb06eb9c461eb3cf449e25a3a53be7299
Signed-off-by: jooseong.lee <jooseong.lee@samsung.com>
security/smack/smack_lsm.c