From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 942C2C43334 for ; Tue, 14 Jun 2022 05:38:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240104AbiFNFif (ORCPT ); Tue, 14 Jun 2022 01:38:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346516AbiFNFia (ORCPT ); Tue, 14 Jun 2022 01:38:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA0D2B26C for ; Mon, 13 Jun 2022 22:38:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8750BB81649 for ; Tue, 14 Jun 2022 05:38:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09168C3411B; Tue, 14 Jun 2022 05:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655185107; bh=TUhaPG/zxoBGFQdav+4Zj5v/KaSlZdbKvwElcae+ekM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PRRynFCKlFafYnFV+FXpS5mPmjmy9RbNBZIUudNs33AxblZJIL3y/AITp9ILp48mS h+gQHIe1pnbh6so8jxUOGl+g2NLM32vBs8Abet1BoL/7FebxtRtxs31XcYKznjzbUn MVC/LOgyDSEKZXlSvDySRxmj58gTLtMWugNCXjEcoDTl6+zxwyWbWiZc7PUJjNHysi ZNXPAcJPUIjO3vANraA3A4bExaGTvuUXDbjOXeXBI7Yv3v2NVRJ9LTJyV/8jLxgkBh 14UjGCW8T5dGbC/czXUGtUV9ygaqQ4sm9a0w7/97E9FQT6R68r1ybSrSavHuRB23L1 8FlXJP2qnIr8Q== Date: Mon, 13 Jun 2022 22:38:25 -0700 From: Eric Biggers To: Daeho Jeong Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong , Nathan Huckleberry Subject: Re: [PATCH] f2fs: handle decompress only post processing in softirq Message-ID: References: <20220613155612.402297-1-daeho43@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220613155612.402297-1-daeho43@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+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 > > 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 > --- > 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