From: Gao Xiang <hsiangkao@redhat.com>
To: Huang Jianan <huangjianan@oppo.com>
Cc: zhangshiming@oppo.com, linux-erofs@lists.ozlabs.org,
guoweichao@oppo.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] erofs: decompress in endio if possible
Date: Mon, 15 Mar 2021 19:28:38 +0800 [thread overview]
Message-ID: <20210315112838.GB838000@xiangao.remote.csb> (raw)
In-Reply-To: <20210305095840.31025-2-huangjianan@oppo.com>
On Fri, Mar 05, 2021 at 05:58:40PM +0800, Huang Jianan via Linux-erofs wrote:
> z_erofs_decompressqueue_endio may not be executed in the atomic
> context, for example, when dm-verity is turned on. In this scenario,
> data can be decompressed directly to get rid of additional kworker
> scheduling overhead. Also, it makes no sense to apply synchronous
> decompression for such case.
>
> Signed-off-by: Huang Jianan <huangjianan@oppo.com>
> Signed-off-by: Guo Weichao <guoweichao@oppo.com>
> ---
> fs/erofs/internal.h | 2 ++
> fs/erofs/super.c | 1 +
> fs/erofs/zdata.c | 16 +++++++++++++---
> 3 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
> index 67a7ec945686..e325da7be237 100644
> --- a/fs/erofs/internal.h
> +++ b/fs/erofs/internal.h
> @@ -53,6 +53,8 @@ struct erofs_fs_context {
>
> /* threshold for decompression synchronously */
> unsigned int max_sync_decompress_pages;
> + /* decide whether to decompress synchronously */
> + bool readahead_sync_decompress;
I updated this as below:
/* current strategy of how to use managed cache */
unsigned char cache_strategy;
+ /* strategy of sync decompression (false - auto, true - force on) */
+ bool readahead_sync_decompress;
/* threshold for decompression synchronously */
unsigned int max_sync_decompress_pages;
> #endif
> unsigned int mount_opt;
> };
...
> @@ -720,8 +723,14 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
> return;
> }
>
> - if (!atomic_add_return(bios, &io->pending_bios))
> - queue_work(z_erofs_workqueue, &io->u.work);
> + if (!atomic_add_return(bios, &io->pending_bios)) {
> + if (in_atomic() || irqs_disabled()) {
> + queue_work(z_erofs_workqueue, &io->u.work);
> + sbi->ctx.readahead_sync_decompress = true;
> + } else {
> + z_erofs_decompressqueue_work(&io->u.work);
> + }
> + }
Also updated this as below to return as early as possible:
- if (!atomic_add_return(bios, &io->pending_bios))
+ if (atomic_add_return(bios, &io->pending_bios))
+ return;
+ /* Use workqueue and sync decompression for atomic contexts only */
+ if (in_atomic() || irqs_disabled()) {
queue_work(z_erofs_workqueue, &io->u.work);
+ sbi->ctx.readahead_sync_decompress = true;
+ return;
+ }
+ z_erofs_decompressqueue_work(&io->u.work);
}
Otherwise, it looks good to me. I've applied to dev-test
for preliminary testing.
Reviewed-by: Gao Xiang <hsiangkao@redhat.com>
Thanks,
Gao Xiang
next prev parent reply other threads:[~2021-03-15 11:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 6:22 [PATCH 1/2] erofs: avoid memory allocation failure during rolling decompression Huang Jianan via Linux-erofs
2021-03-05 6:22 ` [PATCH 2/2] erofs: decompress in endio if possible Huang Jianan via Linux-erofs
2021-03-05 6:41 ` Gao Xiang
2021-03-05 8:21 ` kernel test robot
2021-03-05 6:45 ` [PATCH 1/2] erofs: avoid memory allocation failure during rolling decompression Gao Xiang
2021-03-05 9:58 ` [PATCH v5 " Huang Jianan via Linux-erofs
2021-03-05 9:58 ` [PATCH v5 2/2] erofs: decompress in endio if possible Huang Jianan via Linux-erofs
2021-03-15 11:28 ` Gao Xiang [this message]
2021-03-15 11:24 ` [PATCH v5 1/2] erofs: avoid memory allocation failure during rolling decompression Gao Xiang
2021-03-16 1:11 ` Chao Yu
2021-03-16 1:29 ` Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210315112838.GB838000@xiangao.remote.csb \
--to=hsiangkao@redhat.com \
--cc=guoweichao@oppo.com \
--cc=huangjianan@oppo.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhangshiming@oppo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).