Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1273177iog; Tue, 14 Jun 2022 02:50:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uxCbZXr/Ycqm0K12EYCm9S7LXdLNM8YXBOFVelpj1bkv74w7V/1sKbsscs1hpjXBjub2ap X-Received: by 2002:a17:907:9605:b0:6f5:c66:7c13 with SMTP id gb5-20020a170907960500b006f50c667c13mr3393741ejc.66.1655200227349; Tue, 14 Jun 2022 02:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655200227; cv=none; d=google.com; s=arc-20160816; b=gL2sBTFlw/meTcnYMNUsgYZQuO18+v7LKCO092C5hSAh9MEmCs0neDSVwfQBI+CB9m M1DTzTi7wiGdsjMiGOVcsiYT22S8Hy6W1x4BT9/0KCesZ+4s6H0WoQtyxXc4x63z2fBJ kXpDbMv8oUagOmLHCUYNrRvwYMaVzltdz0OVAK2hehro401ns5B8C5aBF10nlyI62mpp XsZnrAaNMNN0/KewD+clTrEYp5AAy1yagDcS8E2Q68NlNCh+3Lr5TAyoRT895hlGPdt/ L7k0kerarAYv/bZcIHur7NiyrJm9+ziJVsndXlfkDUMc1Vlyh/TMSr4rAVWsKzgPjvpR yLJg== 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; bh=+zppifxoZfPdvbi7pyGEYqceTOfNNwGdpFm0NHpRf9Q=; b=XZWL7eECYbsK5UUOW5tcicJKFuCYDFojZn29NprohWUlA5MbavUPN8N3jS13BYkbiX YM/ZU6jJ/ne0rqO75KGQNPE4YTeYmznd1Y1y6LqzqQGqbPYH35yXZDzkavTXFw4WP+JK ERK8uIifcrQOQfUl9CRWv8KjtUem2HpkftwJiF2pqJL0ozhPVroYM5WQ7A2UnvW+qlLU jCRLFD4cZiGORsJILpzM31a43LN8ctj5R62R4NYkdVpUCfvayUtZV3sBANHJ64atNO5G KYYOMVUpR83nR7pnzfg3lm4YIYBe8HT1UulPVAwF9ybBFfr2Ed7SDcrt0DzNSQSyC8R8 Af6A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c27-20020a1709063f1b00b00710a459160bsi9698396ejj.219.2022.06.14.02.50.02; Tue, 14 Jun 2022 02:50:27 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242587AbiFNJMr (ORCPT + 99 others); Tue, 14 Jun 2022 05:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237934AbiFNJMq (ORCPT ); Tue, 14 Jun 2022 05:12:46 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 437532CE14 for ; Tue, 14 Jun 2022 02:12:41 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R381e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VGMmk6n_1655197957; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VGMmk6n_1655197957) by smtp.aliyun-inc.com; Tue, 14 Jun 2022 17:12:39 +0800 Date: Tue, 14 Jun 2022 17:12:37 +0800 From: Gao Xiang To: Eric Biggers Cc: Daeho Jeong , Daeho Jeong , Nathan Huckleberry , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [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=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 Hi all, On Mon, Jun 13, 2022 at 10:38:25PM -0700, Eric Biggers wrote: > [+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 ... > > 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 > Some my own previous thoughts about this strategy: - If we allocate all memory and map these before I/Os, all inflight I/Os will keep such temporary pages all the time until decompression is finished. In contrast, if we allocate or reuse such pages just before decompression, it would minimize the memory footprints. I think it will impact the memory numbers at least on the very low-ended devices with bslow storage. (I've seen f2fs has some big mempool already) - Many compression algorithms are not suitable in the softirq contexts, also I vaguely remembered if softirq context lasts for > 2ms, it will push into ksoftirqd instead so it's actually another process context. And it may delay other important interrupt handling. - Go back to the non-deterministic scheduling of workqueues. I guess it may be just due to scheduling punishment due to a lot of CPU consuming due to decompression before so the priority becomes low, but that is just a pure guess. May be we need to use RT scheduling policy instead. At least with WQ_HIGHPRI for dm-verity at least, but I don't find WQ_HIGHPRI mark for dm-verity. Thanks, Gao Xiang