f2fs: use kmem_cache pool during inline xattr lookups
It's been observed that kzalloc() on lookup_all_xattrs() are called millions of times on Android, quickly becoming the top abuser of slub memory allocator. Use a dedicated kmem cache pool for xattr lookups to mitigate this. Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -1202,6 +1202,7 @@ static void f2fs_put_super(struct super_block *sb)
|
||||
kvfree(sbi->raw_super);
|
||||
|
||||
destroy_device_list(sbi);
|
||||
f2fs_destroy_xattr_caches(sbi);
|
||||
mempool_destroy(sbi->write_io_dummy);
|
||||
#ifdef CONFIG_QUOTA
|
||||
for (i = 0; i < MAXQUOTAS; i++)
|
||||
@@ -3458,12 +3459,17 @@ try_onemore:
|
||||
}
|
||||
}
|
||||
|
||||
/* init per sbi slab cache */
|
||||
err = f2fs_init_xattr_caches(sbi);
|
||||
if (err)
|
||||
goto free_io_dummy;
|
||||
|
||||
/* get an inode for meta space */
|
||||
sbi->meta_inode = f2fs_iget(sb, F2FS_META_INO(sbi));
|
||||
if (IS_ERR(sbi->meta_inode)) {
|
||||
f2fs_err(sbi, "Failed to read F2FS meta data inode");
|
||||
err = PTR_ERR(sbi->meta_inode);
|
||||
goto free_io_dummy;
|
||||
goto free_xattr_cache;
|
||||
}
|
||||
|
||||
err = f2fs_get_valid_checkpoint(sbi);
|
||||
@@ -3736,6 +3742,8 @@ free_meta_inode:
|
||||
make_bad_inode(sbi->meta_inode);
|
||||
iput(sbi->meta_inode);
|
||||
sbi->meta_inode = NULL;
|
||||
free_xattr_cache:
|
||||
f2fs_destroy_xattr_caches(sbi);
|
||||
free_io_dummy:
|
||||
mempool_destroy(sbi->write_io_dummy);
|
||||
free_percpu:
|
||||
|
Reference in New Issue
Block a user