erofs: introduce nolargefolio mount option
Subsystems (3)
Chao Yu
maintainerPATCH 1/1 erofs: introduce nolargefolio mount option
This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand.
--- Documentation/filesystems/erofs.rst | 1 + fs/erofs/inode.c | 3 ++- fs/erofs/internal.h | 1 + fs/erofs/super.c | 8 +++++++- 4 files changed, 11 insertions(+), 2 deletions(-)
Documentation/filesystems/erofs.rst +1 -0
@@ -137,6 +137,7 @@ fsoffset=%llu Specify block-aligned filesystem offset for the primary d inode_share Enable inode page sharing for this filesystem. Inodes with identical content within the same domain ID can share the page cache. +nolargefolio Disable large folio support for all files. =================== ========================================================= Sysfs Entries
fs/erofs/inode.c +2 -1
@@ -254,7 +254,8 @@ static int erofs_fill_inode(struct inode *inode)return 0 ; } -mapping_set_large_folios (inode->i_mapping); +if (!test_opt (&EROFS_SB (inode->i_sb)->opt,NO_LARGE_FOLIO )) +mapping_set_large_folios (inode->i_mapping); aops =erofs_get_aops (inode, false);if (IS_ERR (aops))return PTR_ERR (aops);
fs/erofs/internal.h +1 -0
@@ -177,6 +177,7 @@ struct erofs_sb_info {#define EROFS_MOUNT_DAX_NEVER 0x00000080#define EROFS_MOUNT_DIRECT_IO 0x00000100#define EROFS_MOUNT_INODE_SHARE 0x00000200 +#define EROFS_MOUNT_NO_LARGE_FOLIO 0x00000400#define clear_opt (opt, option) ((opt)->mount_opt &= ~EROFS_MOUNT_##option)#define set_opt (opt, option) ((opt)->mount_opt |= EROFS_MOUNT_##option)
fs/erofs/super.c +7 -1
@@ -390,7 +390,7 @@ static void erofs_default_options(struct erofs_sb_info *sbi)enum { Opt_user_xattr, Opt_acl, Opt_cache_strategy, Opt_dax, Opt_dax_enum, Opt_device, Opt_fsid, Opt_domain_id, Opt_directio, Opt_fsoffset, - Opt_inode_share, + Opt_inode_share, Opt_nolargefolio, };static const struct constant_table erofs_param_cache_strategy[] = {
@@ -419,6 +419,7 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = {fsparam_flag_no ("directio" , Opt_directio),fsparam_u64 ("fsoffset" , Opt_fsoffset),fsparam_flag ("inode_share" , Opt_inode_share), + fsparam_flag("nolargefolio", Opt_nolargefolio), {} };
@@ -541,6 +542,9 @@ static int erofs_fc_parse_param(struct fs_context *fc,else set_opt (&sbi->opt,INODE_SHARE );break ; +case Opt_nolargefolio: +set_opt (&sbi->opt,NO_LARGE_FOLIO ); +break ; }return 0 ; }
@@ -1105,6 +1109,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)seq_printf (seq,",fsoffset=%llu" , sbi->dif0.fsoff);if (test_opt (opt,INODE_SHARE ))seq_puts (seq,",inode_share" ); +if (test_opt (opt,NO_LARGE_FOLIO )) +seq_puts (seq,",nolargefolio" );return 0 ; }
Signature · 1 line
2.49.0
Hi Chao,
(+cc -fsdevel, willy, Jan kara)
Quoted 5 lines · Chao Yu
This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand.
For this kind of options, I think more real backgrounds about avoiding high-order allocations are needed in the commit message (at least for later reference) also like what I observed in:
https://android-review.googlesource.com/c/kernel/common/+/3877981
because the entire community tends to enable large folios unconditionally if possible. Without enough clarification, even I merge this, there will be endless questions again and again about this.
And Jan once raised up if it should be a user interface or auto-tuning one:
https://lore.kernel.org/r/z2ule3ilnnpoevo5mvt3intvjtuyud7vg3pbfauon47fhr4owa@giaehpbie4a5
My question is that if the needs are real, I wonder if it should be a vfs generic decision instead (because it's not due to the filesystem restriction but due to real system memory pressure or heavy workload for example). However, if the answer is that others don't really care about this, I'm fine to leave it as an erofs-specific option as long as the actual case is clear in the commit message.
Thanks,
Gao Xiang
Quoted 87 lines
Signed-off-by Chao Yu <[email protected]>--- Documentation/filesystems/erofs.rst | 1 + fs/erofs/inode.c | 3 ++- fs/erofs/internal.h | 1 + fs/erofs/super.c | 8 +++++++- 4 files changed, 11 insertions(+), 2 deletions(-)Documentation/filesystems/erofs.rst +1
-0@@ -137,6 +137,7 @@ fsoffset=%llu Specify block-aligned filesystem offset for the primary d inode_share Enable inode page sharing for this filesystem. Inodes with identical content within the same domain ID can share the page cache. +nolargefolio Disable large folio support for all files. =================== ========================================================= Sysfs Entriesfs/erofs/inode.c +2
-1@@ -254,7 +254,8 @@ static int erofs_fill_inode(struct inode *inode)return 0 ; } -mapping_set_large_folios (inode->i_mapping); +if (!test_opt (&EROFS_SB (inode->i_sb)->opt,NO_LARGE_FOLIO )) +mapping_set_large_folios (inode->i_mapping); aops =erofs_get_aops (inode, false);if (IS_ERR (aops))return PTR_ERR (aops);fs/erofs/internal.h +1
-0@@ -177,6 +177,7 @@ struct erofs_sb_info {#define EROFS_MOUNT_DAX_NEVER 0x00000080#define EROFS_MOUNT_DIRECT_IO 0x00000100#define EROFS_MOUNT_INODE_SHARE 0x00000200 +#define EROFS_MOUNT_NO_LARGE_FOLIO 0x00000400#define clear_opt (opt, option) ((opt)->mount_opt &= ~EROFS_MOUNT_##option)#define set_opt (opt, option) ((opt)->mount_opt |= EROFS_MOUNT_##option)fs/erofs/super.c +7
-1@@ -390,7 +390,7 @@ static void erofs_default_options(struct erofs_sb_info *sbi)enum { Opt_user_xattr, Opt_acl, Opt_cache_strategy, Opt_dax, Opt_dax_enum, Opt_device, Opt_fsid, Opt_domain_id, Opt_directio, Opt_fsoffset, - Opt_inode_share, + Opt_inode_share, Opt_nolargefolio, };static const struct constant_table erofs_param_cache_strategy[] = {@@ -419,6 +419,7 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = {fsparam_flag_no ("directio" , Opt_directio),fsparam_u64 ("fsoffset" , Opt_fsoffset),fsparam_flag ("inode_share" , Opt_inode_share), + fsparam_flag("nolargefolio", Opt_nolargefolio), {} };@@ -541,6 +542,9 @@ static int erofs_fc_parse_param(struct fs_context *fc,else set_opt (&sbi->opt,INODE_SHARE );break ; +case Opt_nolargefolio: +set_opt (&sbi->opt,NO_LARGE_FOLIO ); +break ; }return 0 ; }@@ -1105,6 +1109,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)seq_printf (seq,",fsoffset=%llu" , sbi->dif0.fsoff);if (test_opt (opt,INODE_SHARE ))seq_puts (seq,",inode_share" ); +if (test_opt (opt,NO_LARGE_FOLIO )) +seq_puts (seq,",nolargefolio" );return 0 ; }
Hi Chao,
(+cc -fsdevel, willy, Jan kara)
Quoted 5 lines · Chao Yu
This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand.
For this kind of options, I think more real backgrounds about avoiding high-order allocations are needed in the commit message (at least for later reference) also like what I observed in:
https://android-review.googlesource.com/c/kernel/common/+/3877981
because the entire community tends to enable large folios unconditionally if possible. Without enough clarification, even I merge this, there will be endless questions again and again about this.
And Jan once raised up if it should be a user interface or auto-tuning one:
https://lore.kernel.org/r/z2ule3ilnnpoevo5mvt3intvjtuyud7vg3pbfauon47fhr4owa@giaehpbie4a5
My question is that if the needs are real, I wonder if it should be a vfs generic decision instead (because it's not due to the filesystem restriction but due to real system memory pressure or heavy workload for example). However, if the answer is that others don't really care about this, I'm fine to leave it as an erofs-specific option as long as the actual case is clear in the commit message.
Thanks,
Gao Xiang
Quoted 87 lines
Signed-off-by Chao Yu <[email protected]>--- Documentation/filesystems/erofs.rst | 1 + fs/erofs/inode.c | 3 ++- fs/erofs/internal.h | 1 + fs/erofs/super.c | 8 +++++++- 4 files changed, 11 insertions(+), 2 deletions(-)Documentation/filesystems/erofs.rst +1
-0@@ -137,6 +137,7 @@ fsoffset=%llu Specify block-aligned filesystem offset for the primary d inode_share Enable inode page sharing for this filesystem. Inodes with identical content within the same domain ID can share the page cache. +nolargefolio Disable large folio support for all files. =================== ========================================================= Sysfs Entriesfs/erofs/inode.c +2
-1@@ -254,7 +254,8 @@ static int erofs_fill_inode(struct inode *inode)return 0 ; } -mapping_set_large_folios (inode->i_mapping); +if (!test_opt (&EROFS_SB (inode->i_sb)->opt,NO_LARGE_FOLIO )) +mapping_set_large_folios (inode->i_mapping); aops =erofs_get_aops (inode, false);if (IS_ERR (aops))return PTR_ERR (aops);fs/erofs/internal.h +1
-0@@ -177,6 +177,7 @@ struct erofs_sb_info {#define EROFS_MOUNT_DAX_NEVER 0x00000080#define EROFS_MOUNT_DIRECT_IO 0x00000100#define EROFS_MOUNT_INODE_SHARE 0x00000200 +#define EROFS_MOUNT_NO_LARGE_FOLIO 0x00000400#define clear_opt (opt, option) ((opt)->mount_opt &= ~EROFS_MOUNT_##option)#define set_opt (opt, option) ((opt)->mount_opt |= EROFS_MOUNT_##option)fs/erofs/super.c +7
-1@@ -390,7 +390,7 @@ static void erofs_default_options(struct erofs_sb_info *sbi)enum { Opt_user_xattr, Opt_acl, Opt_cache_strategy, Opt_dax, Opt_dax_enum, Opt_device, Opt_fsid, Opt_domain_id, Opt_directio, Opt_fsoffset, - Opt_inode_share, + Opt_inode_share, Opt_nolargefolio, };static const struct constant_table erofs_param_cache_strategy[] = {@@ -419,6 +419,7 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = {fsparam_flag_no ("directio" , Opt_directio),fsparam_u64 ("fsoffset" , Opt_fsoffset),fsparam_flag ("inode_share" , Opt_inode_share), + fsparam_flag("nolargefolio", Opt_nolargefolio), {} };@@ -541,6 +542,9 @@ static int erofs_fc_parse_param(struct fs_context *fc,else set_opt (&sbi->opt,INODE_SHARE );break ; +case Opt_nolargefolio: +set_opt (&sbi->opt,NO_LARGE_FOLIO ); +break ; }return 0 ; }@@ -1105,6 +1109,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)seq_printf (seq,",fsoffset=%llu" , sbi->dif0.fsoff);if (test_opt (opt,INODE_SHARE ))seq_puts (seq,",inode_share" ); +if (test_opt (opt,NO_LARGE_FOLIO )) +seq_puts (seq,",nolargefolio" );return 0 ; }
Quoted 17 lines · Gao Xiang
Hi Chao,
(+cc -fsdevel, willy, Jan kara)
Quoted 5 lines · Chao Yu
This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand.
For this kind of options, I think more real backgrounds about avoiding high-order allocations are needed in the commit message (at least for later reference) also like what I observed in:
https://android-review.googlesource.com/c/kernel/common/+/3877981
Quoted 4 lines
because the entire community tends to enable large folios unconditionally if possible. Without enough clarification, even I merge this, there will be endless questions again and again about this.
This was a decision made early on. If the heuristics are wrong, they need to be fixed. It's very disappointing to see people try to sneak these changes into individual filesystems. Thanks for catching it and preventing it from sneaking in. Chao is not a new contributor; he should know better than this by now.
Quoted 99 lines
And Jan once raised up if it should be a user interface or auto-tuning one:
https://lore.kernel.org/r/z2ule3ilnnpoevo5mvt3intvjtuyud7vg3pbfauon47fhr4owa@giaehpbie4a5My question is that if the needs are real, I wonder if it should be a vfs generic decision instead (because it's not due to the filesystem restriction but due to real system memory pressure or heavy workload for example). However, if the answer is that others don't really care about this, I'm fine to leave it as an erofs-specific option as long as the actual case is clear in the commit message.
Thanks,
Gao XiangQuoted 81 lines
Signed-off-by Chao Yu <[email protected]>--- Documentation/filesystems/erofs.rst | 1 + fs/erofs/inode.c | 3 ++- fs/erofs/internal.h | 1 + fs/erofs/super.c | 8 +++++++- 4 files changed, 11 insertions(+), 2 deletions(-)Documentation/filesystems/erofs.rst +1
-0@@ -137,6 +137,7 @@ fsoffset=%llu Specify block-aligned filesystem offset for the primary d inode_share Enable inode page sharing for this filesystem. Inodes with identical content within the same domain ID can share the page cache. +nolargefolio Disable large folio support for all files. =================== ========================================================= Sysfs Entriesfs/erofs/inode.c +2
-1@@ -254,7 +254,8 @@ static int erofs_fill_inode(struct inode *inode)return 0 ; } -mapping_set_large_folios (inode->i_mapping); +if (!test_opt (&EROFS_SB (inode->i_sb)->opt,NO_LARGE_FOLIO )) +mapping_set_large_folios (inode->i_mapping); aops =erofs_get_aops (inode, false);if (IS_ERR (aops))return PTR_ERR (aops);fs/erofs/internal.h +1
-0@@ -177,6 +177,7 @@ struct erofs_sb_info {#define EROFS_MOUNT_DAX_NEVER 0x00000080#define EROFS_MOUNT_DIRECT_IO 0x00000100#define EROFS_MOUNT_INODE_SHARE 0x00000200 +#define EROFS_MOUNT_NO_LARGE_FOLIO 0x00000400#define clear_opt (opt, option) ((opt)->mount_opt &= ~EROFS_MOUNT_##option)#define set_opt (opt, option) ((opt)->mount_opt |= EROFS_MOUNT_##option)fs/erofs/super.c +7
-1@@ -390,7 +390,7 @@ static void erofs_default_options(struct erofs_sb_info *sbi)enum { Opt_user_xattr, Opt_acl, Opt_cache_strategy, Opt_dax, Opt_dax_enum, Opt_device, Opt_fsid, Opt_domain_id, Opt_directio, Opt_fsoffset, - Opt_inode_share, + Opt_inode_share, Opt_nolargefolio, };static const struct constant_table erofs_param_cache_strategy[] = {@@ -419,6 +419,7 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = {fsparam_flag_no ("directio" , Opt_directio),fsparam_u64 ("fsoffset" , Opt_fsoffset),fsparam_flag ("inode_share" , Opt_inode_share), + fsparam_flag("nolargefolio", Opt_nolargefolio), {} };@@ -541,6 +542,9 @@ static int erofs_fc_parse_param(struct fs_context *fc,else set_opt (&sbi->opt,INODE_SHARE );break ; +case Opt_nolargefolio: +set_opt (&sbi->opt,NO_LARGE_FOLIO ); +break ; }return 0 ; }@@ -1105,6 +1109,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)seq_printf (seq,",fsoffset=%llu" , sbi->dif0.fsoff);if (test_opt (opt,INODE_SHARE ))seq_puts (seq,",inode_share" ); +if (test_opt (opt,NO_LARGE_FOLIO )) +seq_puts (seq,",nolargefolio" );return 0 ; }
Jan Kara
reviewerQuoted 23 lines · Matthew Wilcox
Quoted 17 lines · Gao Xiang
Hi Chao,
(+cc -fsdevel, willy, Jan kara)
Quoted 5 lines · Chao Yu
This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand.
For this kind of options, I think more real backgrounds about avoiding high-order allocations are needed in the commit message (at least for later reference) also like what I observed in:
https://android-review.googlesource.com/c/kernel/common/+/3877981Quoted 4 lines
because the entire community tends to enable large folios unconditionally if possible. Without enough clarification, even I merge this, there will be endless questions again and again about this.
Quoted 5 lines
This was a decision made early on. If the heuristics are wrong, they need to be fixed. It's very disappointing to see people try to sneak these changes into individual filesystems. Thanks for catching it and preventing it from sneaking in. Chao is not a new contributor; he should know better than this by now.
I agree improving the heuristics is much better (fixes the problem for everyone) than disabling large folios (even more so on per-fs basis). As I'm rereading the old thread Gao referenced the concern here is about small (as in below 1g of memory) devices where apparently the memory overhead of large folios hurts significantly. Perhaps we could tune the folio order we allocate based on the current size of the page cache on the device or something like that?
Honza
Quoted 99 lines
Quoted 99 lines
And Jan once raised up if it should be a user interface or auto-tuning one:
https://lore.kernel.org/r/z2ule3ilnnpoevo5mvt3intvjtuyud7vg3pbfauon47fhr4owa@giaehpbie4a5My question is that if the needs are real, I wonder if it should be a vfs generic decision instead (because it's not due to the filesystem restriction but due to real system memory pressure or heavy workload for example). However, if the answer is that others don't really care about this, I'm fine to leave it as an erofs-specific option as long as the actual case is clear in the commit message.
Thanks,
Gao XiangQuoted 81 lines
Signed-off-by Chao Yu <[email protected]>--- Documentation/filesystems/erofs.rst | 1 + fs/erofs/inode.c | 3 ++- fs/erofs/internal.h | 1 + fs/erofs/super.c | 8 +++++++- 4 files changed, 11 insertions(+), 2 deletions(-)Documentation/filesystems/erofs.rst +1
-0@@ -137,6 +137,7 @@ fsoffset=%llu Specify block-aligned filesystem offset for the primary d inode_share Enable inode page sharing for this filesystem. Inodes with identical content within the same domain ID can share the page cache. +nolargefolio Disable large folio support for all files. =================== ========================================================= Sysfs Entriesfs/erofs/inode.c +2
-1@@ -254,7 +254,8 @@ static int erofs_fill_inode(struct inode *inode)return 0 ; } -mapping_set_large_folios (inode->i_mapping); +if (!test_opt (&EROFS_SB (inode->i_sb)->opt,NO_LARGE_FOLIO )) +mapping_set_large_folios (inode->i_mapping); aops =erofs_get_aops (inode, false);if (IS_ERR (aops))return PTR_ERR (aops);fs/erofs/internal.h +1
-0@@ -177,6 +177,7 @@ struct erofs_sb_info {#define EROFS_MOUNT_DAX_NEVER 0x00000080#define EROFS_MOUNT_DIRECT_IO 0x00000100#define EROFS_MOUNT_INODE_SHARE 0x00000200 +#define EROFS_MOUNT_NO_LARGE_FOLIO 0x00000400#define clear_opt (opt, option) ((opt)->mount_opt &= ~EROFS_MOUNT_##option)#define set_opt (opt, option) ((opt)->mount_opt |= EROFS_MOUNT_##option)fs/erofs/super.c +7
-1@@ -390,7 +390,7 @@ static void erofs_default_options(struct erofs_sb_info *sbi)enum { Opt_user_xattr, Opt_acl, Opt_cache_strategy, Opt_dax, Opt_dax_enum, Opt_device, Opt_fsid, Opt_domain_id, Opt_directio, Opt_fsoffset, - Opt_inode_share, + Opt_inode_share, Opt_nolargefolio, };static const struct constant_table erofs_param_cache_strategy[] = {@@ -419,6 +419,7 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = {fsparam_flag_no ("directio" , Opt_directio),fsparam_u64 ("fsoffset" , Opt_fsoffset),fsparam_flag ("inode_share" , Opt_inode_share), + fsparam_flag("nolargefolio", Opt_nolargefolio), {} };@@ -541,6 +542,9 @@ static int erofs_fc_parse_param(struct fs_context *fc,else set_opt (&sbi->opt,INODE_SHARE );break ; +case Opt_nolargefolio: +set_opt (&sbi->opt,NO_LARGE_FOLIO ); +break ; }return 0 ; }@@ -1105,6 +1109,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)seq_printf (seq,",fsoffset=%llu" , sbi->dif0.fsoff);if (test_opt (opt,INODE_SHARE ))seq_puts (seq,",inode_share" ); +if (test_opt (opt,NO_LARGE_FOLIO )) +seq_puts (seq,",nolargefolio" );return 0 ; }
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Chao Yu
maintainerXiang,
Quoted 11 lines · Gao Xiang
Hi Chao,
(+cc -fsdevel, willy, Jan kara)
Quoted 5 lines · Chao Yu
This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand.
Quoted 5 lines
For this kind of options, I think more real backgrounds about avoiding high-order allocations are needed in the commit message (at least for later reference) also like what I observed in:
https://android-review.googlesource.com/c/kernel/common/+/3877981
Basically, the background is about contention scenario on large folio allocation, it's among multiple users including EROFS in Android-system, as it's related to internal scene of product, so I can not provide more details now, I'm sorry about that, but I'm glad to discuss based on the background and pain point once if I can share more, let's see. :)
Quoted 9 lines
because the entire community tends to enable large folios unconditionally if possible. Without enough clarification, even I merge this, there will be endless questions again and again about this.
And Jan once raised up if it should be a user interface or auto-tuning one:
https://lore.kernel.org/r/z2ule3ilnnpoevo5mvt3intvjtuyud7vg3pbfauon47fhr4owa@giaehpbie4a5
Thanks for sharing this anyway, I didn't notice this previously...
Thanks,
Quoted 95 lines
Quoted 1 line
My question is that if the needs are real, I wonder if
it should be a vfs generic decision instead (because it's not due to the filesystem restriction but due to real system memory pressure or heavy workload for example). However, if the answer is that others don't really care about this, I'm fine to leave it as an erofs-specific option as long as the actual case is clear in the commit message.
Quoted 1 line
Thanks,
Gao Xiang
Quoted 82 lines
Signed-off-by Chao Yu <[email protected]>---
Documentation/filesystems/erofs.rst| 1 + fs/erofs/inode.c | 3 ++- fs/erofs/internal.h | 1 + fs/erofs/super.c | 8 +++++++-4 files changed, 11 insertions(+), 2 deletions(-)Documentation/filesystems/erofs.rst +0
-0@@ -137,6 +137,7 @@ fsoffset=%llu Specify block-aligned filesystem offset for the primary dinode_share Enable inode page sharing for this filesystem. Inodes with identical content within the same domain ID can share the page cache.
+nolargefolio Disable large folio support for all files. =================== ========================================================= Sysfs Entriesfs/erofs/inode.c +2
-0@@ -254,7 +254,8 @@ static int erofs_fill_inode(struct inode *inode) return 0; } - mapping_set_large_folios(inode->i_mapping); + if (!test_opt(&EROFS_SB(inode->i_sb)->opt, NO_LARGE_FOLIO)) + mapping_set_large_folios(inode->i_mapping); aops = erofs_get_aops(inode, false); if (IS_ERR(aops)) return PTR_ERR(aops);fs/erofs/internal.h +1
-0@@ -177,6 +177,7 @@ struct erofs_sb_info { #define EROFS_MOUNT_DAX_NEVER 0x00000080 #define EROFS_MOUNT_DIRECT_IO 0x00000100 #define EROFS_MOUNT_INODE_SHARE 0x00000200 +#define EROFS_MOUNT_NO_LARGE_FOLIO 0x00000400 #define clear_opt(opt, option) ((opt)->mount_opt &= ~EROFS_MOUNT_##option) #define set_opt(opt, option) ((opt)->mount_opt |= EROFS_MOUNT_##option)fs/erofs/super.c +2
-1@@ -390,7 +390,7 @@ static void erofs_default_options(struct erofs_sb_info *sbi) enum { Opt_user_xattr, Opt_acl, Opt_cache_strategy, Opt_dax, Opt_dax_enum, Opt_device, Opt_fsid, Opt_domain_id, Opt_directio, Opt_fsoffset, - Opt_inode_share, + Opt_inode_share, Opt_nolargefolio, }; static const struct constant_table erofs_param_cache_strategy[] = {@@ -419,6 +419,7 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = { fsparam_flag_no("directio", Opt_directio), fsparam_u64("fsoffset", Opt_fsoffset), fsparam_flag("inode_share", Opt_inode_share), + fsparam_flag("nolargefolio", Opt_nolargefolio), {} }; @@ -541,6 +542,9 @@ static int erofs_fc_parse_param(struct fs_context *fc,else
set_opt(&sbi->opt, INODE_SHARE);
break;
+ caseOpt_nolargefolio:
+set_opt(&sbi->opt, NO_LARGE_FOLIO);
+ break;
}
return 0;
}fs/erofs/super.c +2
-0@@ -1105,6 +1109,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root) seq_printf(seq, ",fsoffset=%llu", sbi->dif0.fsoff); if (test_opt(opt, INODE_SHARE)) seq_puts(seq, ",inode_share"); + if (test_opt(opt, NO_LARGE_FOLIO)) + seq_puts(seq, ",nolargefolio"); return 0; }
Quoted 20 lines · Chao Yu
Xiang,
Quoted 11 lines · Gao Xiang
Hi Chao,
(+cc -fsdevel, willy, Jan kara)
Quoted 5 lines · Chao Yu
This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand.
Quoted 5 lines
For this kind of options, I think more real backgrounds about avoiding high-order allocations are needed in the commit message (at least for later reference) also like what I observed in:
https://android-review.googlesource.com/c/kernel/common/+/3877981
Quoted 5 lines
Basically, the background is about contention scenario on large folio allocation, it's among multiple users including EROFS in Android-system, as it's related to internal scene of product, so I can not provide more details now, I'm sorry about that, but I'm glad to discuss based on the background and pain point once if I can share more, let's see. :)
Understood, but I think it's hard to justify an upstream solution without a public load for discussion. Anyway, I can imagine some real workloads which large folios could cause unnecessary pressure since I once worked for Android, but I think others need an explicit one anyway to justify this.
As Matthew and Jan mentioned, it's hard to add a per-fs knob like this. If it's Android-specific and no possible public infos, I suggest leaving the changes Android downstream for now, until the workloads can be made public.
Thanks,
Gao Xiang
Chao Yu
maintainerQuoted 29 lines · Gao Xiang
Quoted 20 lines · Chao Yu
Xiang,
Quoted 11 lines · Gao Xiang
Hi Chao,
(+cc -fsdevel, willy, Jan kara)
Quoted 5 lines · Chao Yu
This patch introduces a new mount option 'nolargefolio' for EROFS. When this option is specified, large folio will be disabled by default for all inodes, this option can be used for environments where large folio resources are limited, it's necessary to only let specified user to allocate large folios on demand.
Quoted 5 lines
For this kind of options, I think more real backgrounds about avoiding high-order allocations are needed in the commit message (at least for later reference) also like what I observed in:
https://android-review.googlesource.com/c/kernel/common/+/3877981Quoted 5 lines
Basically, the background is about contention scenario on large folio allocation, it's among multiple users including EROFS in Android-system, as it's related to internal scene of product, so I can not provide more details now, I'm sorry about that, but I'm glad to discuss based on the background and pain point once if I can share more, let's see. :)
Quoted 6 lines
Understood, but I think it's hard to justify an upstream solution without a public load for discussion. Anyway, I can imagine some real workloads which large folios could cause unnecessary pressure since I once worked for Android, but I think others need an explicit one anyway to justify this.
Yes,
Quoted 5 lines
As Matthew and Jan mentioned, it's hard to add a per-fs knob like this. If it's Android-specific and no possible public infos, I suggest leaving the changes Android downstream for now, until the workloads can be made public.
Sure, I can understand that we're not going to accept per-fs change on large folio policy, as if there is conclusion or agreement about this in previous discussion from community.
Thanks for the suggestion, I can take a look from downstream side.
Thanks,
Quoted 3 lines
Thanks,
Gao Xiang