diff options
author | Ayush Mittal <ayush.m@samsung.com> | 2019-02-05 23:55:42 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-08 06:57:32 -0500 |
commit | 26e28d68b146ec17ecc1b1833077bc712de19637 (patch) | |
tree | 80cbc5a23bfefac2591b31c10b2e4c82a6767020 /fs/kernfs/dir.c | |
parent | 5b2f2bd62e79f6bc38fda5a0ff6a699f7612a7d2 (diff) |
kernfs: Allocating memory for kernfs_iattrs with kmem_cache.
Creating a new cache for kernfs_iattrs.
Currently, memory is allocated with kzalloc() which
always gives aligned memory. On ARM, this is 64 byte aligned.
To avoid the wastage of memory in aligning the size requested,
a new cache for kernfs_iattrs is created.
Size of struct kernfs_iattrs is 80 Bytes.
On ARM, it will come in kmalloc-128 slab.
and it will come in kmalloc-192 slab if debug info is enabled.
Extra bytes taken 48 bytes.
Total number of objects created : 4096
Total saving = 48*4096 = 192 KB
After creating new slab(When debug info is enabled) :
sh-3.2# cat /proc/slabinfo
...
kernfs_iattrs_cache 4069 4096 128 32 1 : tunables 0 0 0 : slabdata 128 128 0
...
All testing has been done on ARM target.
Signed-off-by: Ayush Mittal <ayush.m@samsung.com>
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/dir.c')
-rw-r--r-- | fs/kernfs/dir.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 4ca0b5c18192..b84d635567d3 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -536,8 +536,8 @@ void kernfs_put(struct kernfs_node *kn) | |||
536 | security_release_secctx(kn->iattr->ia_secdata, | 536 | security_release_secctx(kn->iattr->ia_secdata, |
537 | kn->iattr->ia_secdata_len); | 537 | kn->iattr->ia_secdata_len); |
538 | simple_xattrs_free(&kn->iattr->xattrs); | 538 | simple_xattrs_free(&kn->iattr->xattrs); |
539 | kmem_cache_free(kernfs_iattrs_cache, kn->iattr); | ||
539 | } | 540 | } |
540 | kfree(kn->iattr); | ||
541 | spin_lock(&kernfs_idr_lock); | 541 | spin_lock(&kernfs_idr_lock); |
542 | idr_remove(&root->ino_idr, kn->id.ino); | 542 | idr_remove(&root->ino_idr, kn->id.ino); |
543 | spin_unlock(&kernfs_idr_lock); | 543 | spin_unlock(&kernfs_idr_lock); |