Messages in this thread | | | Date | Mon, 13 Jun 2022 22:38:25 -0700 | From | Eric Biggers <> | Subject | Re: [PATCH] f2fs: handle decompress only post processing in softirq |
| |
[+Cc Nathan Huckleberry who is looking into a similar problem in dm-verity]
On Mon, Jun 13, 2022 at 08:56:12AM -0700, Daeho Jeong wrote: > From: Daeho Jeong <daehojeong@google.com> > > Now decompression is being handled in workqueue and it makes read I/O > latency non-deterministic, because of the non-deterministic scheduling > nature of workqueues. So, I made it handled in softirq context only if > possible. > > Signed-off-by: Daeho Jeong <daehojeong@google.com> > --- > fs/f2fs/compress.c | 145 +++++++++++++++++++++++++-------------------- > fs/f2fs/data.c | 50 ++++++++++------ > fs/f2fs/f2fs.h | 10 ++-- > 3 files changed, 119 insertions(+), 86 deletions(-) [...] > static void f2fs_read_end_io(struct bio *bio) > @@ -281,16 +283,28 @@ static void f2fs_read_end_io(struct bio *bio) > } > > if (bio->bi_status) { > - f2fs_finish_read_bio(bio); > + f2fs_finish_read_bio(bio, true); > return; > } > > - if (ctx && (ctx->enabled_steps & (STEP_DECRYPT | STEP_DECOMPRESS))) { > - INIT_WORK(&ctx->work, f2fs_post_read_work); > - queue_work(ctx->sbi->post_read_wq, &ctx->work); > - } else { > - f2fs_verify_and_finish_bio(bio); > + if (ctx) { > + unsigned int enabled_steps = ctx->enabled_steps & > + (STEP_DECRYPT | STEP_DECOMPRESS); > + > + /* > + * If we have only decompression step between decompression and > + * decrypt, we don't need post processing for this. > + */ > + if (enabled_steps == STEP_DECOMPRESS) { > + f2fs_handle_step_decompress(ctx, true);
One question: is this (the bio endio callback) actually guaranteed to be executed from a softirq? If you look at dm-crypt's support for workqueue-less decryption, for example, it explicitly checks 'in_hardirq() || irqs_disabled()' and schedules a tasklet if either of those is the case.
- Eric
| |