diff options
author | Jeff Mahoney <jeffm@suse.com> | 2018-02-15 22:59:47 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-03-01 10:15:36 -0500 |
commit | a8fd1f71749387c9a1053a83ff1c16287499a4e7 (patch) | |
tree | 23741329982b7387302eb9cae8ac3a60eb2fc07c /fs | |
parent | fd649f10c3d21ee9d7542c609f29978bdf73ab94 (diff) |
btrfs: use kvzalloc to allocate btrfs_fs_info
The srcu_struct in btrfs_fs_info scales in size with NR_CPUS. On
kernels built with NR_CPUS=8192, this can result in kmalloc failures
that prevent mounting.
There is work in progress to try to resolve this for every user of
srcu_struct but using kvzalloc will work around the failures until
that is complete.
As an example with NR_CPUS=512 on x86_64: the overall size of
subvol_srcu is 3460 bytes, fs_info is 6496.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ctree.h | 2 | ||||
-rw-r--r-- | fs/btrfs/super.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1a462ab85c49..0f521ba5f2f9 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2974,7 +2974,7 @@ static inline void free_fs_info(struct btrfs_fs_info *fs_info) | |||
2974 | kfree(fs_info->super_copy); | 2974 | kfree(fs_info->super_copy); |
2975 | kfree(fs_info->super_for_commit); | 2975 | kfree(fs_info->super_for_commit); |
2976 | security_free_mnt_opts(&fs_info->security_opts); | 2976 | security_free_mnt_opts(&fs_info->security_opts); |
2977 | kfree(fs_info); | 2977 | kvfree(fs_info); |
2978 | } | 2978 | } |
2979 | 2979 | ||
2980 | /* tree mod log functions from ctree.c */ | 2980 | /* tree mod log functions from ctree.c */ |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 6e71a2a78363..4b817947e00f 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -1545,7 +1545,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type, | |||
1545 | * it for searching for existing supers, so this lets us do that and | 1545 | * it for searching for existing supers, so this lets us do that and |
1546 | * then open_ctree will properly initialize everything later. | 1546 | * then open_ctree will properly initialize everything later. |
1547 | */ | 1547 | */ |
1548 | fs_info = kzalloc(sizeof(struct btrfs_fs_info), GFP_KERNEL); | 1548 | fs_info = kvzalloc(sizeof(struct btrfs_fs_info), GFP_KERNEL); |
1549 | if (!fs_info) { | 1549 | if (!fs_info) { |
1550 | error = -ENOMEM; | 1550 | error = -ENOMEM; |
1551 | goto error_sec_opts; | 1551 | goto error_sec_opts; |