security: smack: add kmem_cache for smack_rule allocations
authorjooseong.lee <jooseong.lee@samsung.com>
Wed, 25 Mar 2015 01:58:44 +0000 (10:58 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 25 Mar 2015 05:23:14 +0000 (14:23 +0900)
commitf2be802502df388bf55de717a9dc4c6ba4c25a98
tree1a60175c160e0b8db6bd20965b6e2b7de2e2b5ee
parenta5070935ff5abb92d51fbc1e75e24a4b1548848e
security: smack: add kmem_cache for smack_rule allocations

On ARM, sizeof(struct smack_rule)==20. Allocation by kmalloc() uses a
32-byte-long chunk to allocate 20 bytes. Just ask ksize().  It means that 40%
of memory is simply wasted for padding bytes.

The problem is fixed in this patch by using kmem_cache. The cache allocates
struct smack_rule using 24-byte-long chunks according to ksize(). This reduces
amount of used memory by 25%.

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