Commit 648f2de0 authored by Huang Jianan's avatar Huang Jianan Committed by Gao Xiang

erofs: use workqueue decompression for atomic contexts only

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.

Link: https://lore.kernel.org/r/20210317035448.13921-2-huangjianan@oppo.comReviewed-by: default avatarGao Xiang <hsiangkao@redhat.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarHuang Jianan <huangjianan@oppo.com>
Signed-off-by: default avatarGuo Weichao <guoweichao@oppo.com>
Signed-off-by: default avatarGao Xiang <hsiangkao@redhat.com>
parent b4892fa3
...@@ -706,6 +706,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, ...@@ -706,6 +706,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
goto out; goto out;
} }
static void z_erofs_decompressqueue_work(struct work_struct *work);
static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
bool sync, int bios) bool sync, int bios)
{ {
...@@ -720,8 +721,14 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, ...@@ -720,8 +721,14 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
return; return;
} }
if (!atomic_add_return(bios, &io->pending_bios)) if (atomic_add_return(bios, &io->pending_bios))
return;
/* Use workqueue decompression for atomic contexts only */
if (in_atomic() || irqs_disabled()) {
queue_work(z_erofs_workqueue, &io->u.work); queue_work(z_erofs_workqueue, &io->u.work);
return;
}
z_erofs_decompressqueue_work(&io->u.work);
} }
static bool z_erofs_page_is_invalidated(struct page *page) static bool z_erofs_page_is_invalidated(struct page *page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment