[PATCH 2/2] erofs: add sysfs node to control sync decompression strategy
Huang Jianan
huangjianan at oppo.com
Tue Nov 9 18:43:06 AEDT 2021
Hi Xiang,
在 2021/11/9 11:16, Gao Xiang 写道:
> On Tue, Nov 09, 2021 at 10:54:45AM +0800, Huang Jianan via Linux-erofs wrote:
>> Although readpage is a synchronous path, there will be no additional
>> kworker scheduling overhead in non-atomic contexts. So we can add a
>> sysfs node to allow disable sync decompression.
>>
>> Signed-off-by: Huang Jianan <huangjianan at oppo.com>
>> ---
>> fs/erofs/internal.h | 2 +-
>> fs/erofs/super.c | 2 +-
>> fs/erofs/sysfs.c | 6 ++++++
>> fs/erofs/zdata.c | 9 ++++-----
>> 4 files changed, 12 insertions(+), 7 deletions(-)
>>
>> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
>> index d0cd712dc222..1ab96878009d 100644
>> --- a/fs/erofs/internal.h
>> +++ b/fs/erofs/internal.h
>> @@ -60,7 +60,7 @@ struct erofs_mount_opts {
>> #ifdef CONFIG_EROFS_FS_ZIP
>> /* current strategy of how to use managed cache */
>> unsigned char cache_strategy;
>> - /* strategy of sync decompression (false - auto, true - force on) */
>> + /* strategy of sync decompression (false - disable, true - force on) */
> Please leave false - auto.
Agree.
>> bool readahead_sync_decompress;
>>
>> /* threshold for decompression synchronously */
>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
>> index abc1da5d1719..26585d865503 100644
>> --- a/fs/erofs/super.c
>> +++ b/fs/erofs/super.c
>> @@ -423,7 +423,7 @@ static void erofs_default_options(struct erofs_fs_context *ctx)
>> #ifdef CONFIG_EROFS_FS_ZIP
>> ctx->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND;
>> ctx->opt.max_sync_decompress_pages = 3;
>> - ctx->opt.readahead_sync_decompress = false;
>> + ctx->opt.readahead_sync_decompress = true;
> Please leave readahead_sync_decompress = false 'auto' by default.
>
> I don't like .readpage() applies async decompression since it's
> actually a sync way, otherwise, it will cause more scheduling
> overhead, see:
> https://lore.kernel.org/r/20201016160443.18685-1-willy@infradead.org
> https://lore.kernel.org/r/20201102184312.25926-16-willy@infradead.org
Maybe consider adding a disbale strategy? And then we will have:
0 - auto, 1 - force on, 2 - disable
I will try this in the next version.
for .readpage(), If the decompression can be done in a non-atomic context,
there will be no additional scheduling overhead? In this case, we can
turn off
the syncdecompression.
Thanks,
Jianan
> Thanks,
> Gao Xiang
More information about the Linux-erofs
mailing list