diff options
author | Kyeongdon Kim <kyeongdon.kim@lge.com> | 2017-09-06 18:50:19 +0900 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2017-09-20 12:01:58 -0400 |
commit | 7c620ece125cbab7b5dfcb574ee1e64ab8b562cd (patch) | |
tree | 53535c964faebf8e3ced3151353c8577213a59cc /security/selinux/ss/services.c | |
parent | 2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e (diff) | |
download | linux-stable-7c620ece125cbab7b5dfcb574ee1e64ab8b562cd.tar.gz linux-stable-7c620ece125cbab7b5dfcb574ee1e64ab8b562cd.tar.bz2 linux-stable-7c620ece125cbab7b5dfcb574ee1e64ab8b562cd.zip |
selinux: Use kmem_cache for hashtab_node
During random test as own device to check slub account,
we found some slack memory from hashtab_node(kmalloc-64).
By using kzalloc(), middle of test result like below:
allocated size 240768
request size 45144
slack size 195624
allocation count 3762
So, we want to use kmem_cache_zalloc() and that
can reduce memory size 52byte(slack size/alloc count) per each struct.
Signed-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r-- | security/selinux/ss/services.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index e4a1c0dc561a..33cfe5d3d6cb 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -2060,10 +2060,12 @@ int security_load_policy(void *data, size_t len) if (!ss_initialized) { avtab_cache_init(); ebitmap_cache_init(); + hashtab_cache_init(); rc = policydb_read(&policydb, fp); if (rc) { avtab_cache_destroy(); ebitmap_cache_destroy(); + hashtab_cache_destroy(); goto out; } @@ -2075,6 +2077,7 @@ int security_load_policy(void *data, size_t len) policydb_destroy(&policydb); avtab_cache_destroy(); ebitmap_cache_destroy(); + hashtab_cache_destroy(); goto out; } @@ -2083,6 +2086,7 @@ int security_load_policy(void *data, size_t len) policydb_destroy(&policydb); avtab_cache_destroy(); ebitmap_cache_destroy(); + hashtab_cache_destroy(); goto out; } |