Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1131501iog; Mon, 13 Jun 2022 22:50:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t7hM27vfo1ZhN4oaf0CFTyFLwJkt/Q0Sr9w7V3adwD7uFhT/pJ1MIU9Dxq8JFpaQnn2Mjz X-Received: by 2002:a17:906:c302:b0:6fe:a216:20a4 with SMTP id s2-20020a170906c30200b006fea21620a4mr2764712ejz.556.1655185835482; Mon, 13 Jun 2022 22:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655185835; cv=none; d=google.com; s=arc-20160816; b=0dwTIlUdCe49c5wQMMKDeJSI6wBuVHXcz4NkUICxU0xjG72T8RIJ5ouYg2QLOeklud QggrdF7BViX6FEu2ulipcERR/spG/kq2aP0RVKOq537MHOJ7PHRIFdoEPAuBbuLc0Poa I2fwobpyb0nyY6VEe+hKY5x5EaR9iNhSZoYhaHdvGKDtH+vPULCE4aJIDIv6tcnVMv2x iw4aAMf/eCs7YDStoEl0WFlD4QJu+sRRTWwLr77DREd8hkIetzVw26zw2m//5bk9vTrK 3d0jR1deyypXVnWxOIOjrRn+Vs556E7kW/C0vGnkCRI/QEt7czPtWTcfc/J610oXkxea JRDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3Z51Jq+CC9Ksw0axyGDD5DV9JLlRzpYPLgLZ39sG3sU=; b=yOHirXxTni5vnrB6H8zPuXzhoTnbB5bf+UjhVXyAuc0gUOlrXUiBPgkIpEIaQKablJ i1CzFRLkb/NFP9ByUrrdW1WrNNtIxHhGVAhkg8VhFD8xeIYOmhdzGe1ToeXO8L6o/mxc NuymfB7f87U8qpvWvzbwGHB86sFw91IPyvxvLiqpgTZ+cG43K1i/jRM85t5PgSP+5dfN 4FSGmjaSBbGO0UzovHHpJyP25Y/riHfUK/aoFuDtg5V5WSs6HoAqjt3WC3Zy08bcT3vG 1S7lah8wrVQ9G5bopeitAOOImASsiadYruH04MoY7Wg1Oj1OsaB6y/4eQ33+Vlz+eHZd MpFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PRRynFCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a50ba88000000b0042def42f765si10425664ede.190.2022.06.13.22.50.09; Mon, 13 Jun 2022 22:50:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PRRynFCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237754AbiFNFie (ORCPT + 99 others); Tue, 14 Jun 2022 01:38:34 -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> X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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