Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2192125ybz; Thu, 23 Apr 2020 13:17:39 -0700 (PDT) X-Google-Smtp-Source: APiQypLFscAB8wv197Rs/qOmlImDGj18PM7imUv7Eql9P8AM4Xz2NJ3+Kte+IygPQAxpY2zAQghY X-Received: by 2002:a17:906:a3da:: with SMTP id ca26mr3528029ejb.125.1587673059482; Thu, 23 Apr 2020 13:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587673059; cv=none; d=google.com; s=arc-20160816; b=LaEBhvu/w2Jg0fH9+hP9225PcKZJ0nRnv9v8gF+sXsPGCa26d5JC20NKiS1SXCCTRY 7mWlP6FGBzLbRwBkSddLuqODpLKod6IFlXr/Qyf7FaPTdy9S8V5uCGi91MQI2QsX7Hup Cvy0LW5K5BtvzfMBKgR4sUDOCibJnt7WalCIRPaR/uiT2LdoDZn4urBAXsZ+Pz3WJ6Zi bpIwETmYoCEqYuBU3WOT0mjOKoX8fLo6tyUSefPCOF9PP4KQCjoOOUuaSXWpCMas8SkA cK2NUvlDNxj84lpe9lLf3Nu1fyggram+tkgcl9f6YqEXNt+TSbSad/kXeFt3Hak6+XM2 nnjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=c2rUn6OEE/SyUFvNfSs4xf0M3jM82iEbBd70o6oUd2c=; b=Og5R1BtMU7o1U6DaaN3gqughXQ3KIDUUPj0VNthT+Wbc7PRwZKMrn3RbkIRWLKHqtn BtJ5BgTK0qW3taSwfAS7CH+HRS4lsTgW6/hweiu6NKFyiMNTtawJJgN9jzo7hNP6x5nm 4F/fAYAYsLj2V7rVFmWEN6aOV6nDIQ4Rw6T7/QTs8qcZBogTpbn1G7oCq1+kmH0WOGxC 5JbshstD3NwqQLPtltOoNP9znvvLzh4ziyUy7xv+HeYvY4Uc/bZIlCufr52euu2dZirP ZT1tnPe4A5Zh8XuQHuyq8pQNj+0NAlyp0q3xL13Phs9ZTYfYYdGsWHtLS6bxcOT/cH0h 6KsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uAeBnTv9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m29si1778236eda.592.2020.04.23.13.17.13; Thu, 23 Apr 2020 13:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uAeBnTv9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726071AbgDWUN6 (ORCPT + 99 others); Thu, 23 Apr 2020 16:13:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbgDWUN5 (ORCPT ); Thu, 23 Apr 2020 16:13:57 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9344BC09B042 for ; Thu, 23 Apr 2020 13:13:57 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id 72so8442778otu.1 for ; Thu, 23 Apr 2020 13:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c2rUn6OEE/SyUFvNfSs4xf0M3jM82iEbBd70o6oUd2c=; b=uAeBnTv9ZhEDHEM0R2gYPziVyPUzWcc2FZmKHluszWUeQZ+mlcnJNqx+toFeod+rG2 5CtqzTIfz4EdeBuiId/090yid1X5A7Wl4mg8teizN+JkxYqU446/EKbttIrGvbCXSLY4 tH4L7LN6h0n0BjbA9qqt2ovfOmTZDTphMD5L7tzI1e1nqOT7l1c2ZP4jBOKHerk8o+2u 7Wcz5PX5oyRcYAec+aWyToiXprU9h0QgmqHWNfVR00m4ilAJ7k574PeLLCBKbD6wtKJ3 Spw5vgab2z50d/5me4yy3csoIGoeL7v0BZdJIhy3gXOsc842o2ssePflinAKaP6Acq4y 7kCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c2rUn6OEE/SyUFvNfSs4xf0M3jM82iEbBd70o6oUd2c=; b=gI5WcK5BoHdUEZUNemnxiE4w/Jy0QbFdbdc4GVww46cT86xOxulFn3mQNj+w9S671n yxyzGLR/wurSMJtDwbE5gSP8biSuosl+OV59KR9UH9qmf9PBbcxUV6yWMmDuACVFL8O7 xCxdb+jdHkVMhfWh6f5E3jF1P1xMOzenV7Zo96gUAls7E/0iSqNRdTEWe/c/2EZrWCcF HMDnTz8KE/ynblLDJ54oVFH7OmFuBEP0c0fg9ZIxMHcVy/x5iGjCEm4jKAC6tXTd7WUp HPlqx3H2Je+SX3etD01StDj/qrTPrGHGwI/gE/qM2K0YXXQdnXkPNBdTrl0JobSTlpcE Jm2w== X-Gm-Message-State: AGi0PuabgN54r+dT+DXyXf2Wl+DKj3q77umZl5QW2nH5iYhQ6AXf4QKy vfc93t7wza/tVolrcYoev48FxIQgEM7O4RceCHVRCA== X-Received: by 2002:a05:6830:23b5:: with SMTP id m21mr5146009ots.63.1587672836590; Thu, 23 Apr 2020 13:13:56 -0700 (PDT) MIME-Version: 1.0 References: <20200206101833.GA20943@ming.t460p> <20200206211222.83170-1-sqazi@google.com> <5707b17f-e5d7-c274-de6a-694098c4e9a2@acm.org> <10c64a02-91fe-c2af-4c0c-dc9677f9b223@acm.org> In-Reply-To: From: Jesse Barnes Date: Thu, 23 Apr 2020 13:13:45 -0700 Message-ID: Subject: Re: [PATCH] block: Limit number of items taken from the I/O scheduler in one go To: Doug Anderson Cc: Salman Qazi , Jens Axboe , Bart Van Assche , Ming Lei , linux-block , Linux Kernel Mailing List , Gwendal Grignou , Hannes Reinecke , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jens, Bart, Ming, any update here? Or is this already applied (I didn't check)? Thanks, Jesse On Mon, Apr 20, 2020 at 9:43 AM Doug Anderson wrote: > > Hi, > > On Fri, Feb 7, 2020 at 12:38 PM Salman Qazi wrote: > > > > On Fri, Feb 7, 2020 at 12:19 PM Bart Van Assche wrote: > > > > > > On 2/7/20 10:45 AM, Salman Qazi wrote: > > > > If I were to write this as a for-loop, it will look like this: > > > > > > > > for (i = 0; i == 0 || (run_again && i < 2); i++) { > > > > /* another level of 8 character wide indentation */ > > > > run_again = false; > > > > /* a bunch of code that possibly sets run_again to true > > > > } > > > > > > > > if (run_again) > > > > blk_mq_run_hw_queue(hctx, true); > > > > > > That's not what I meant. What I meant is a loop that iterates at most > > > two times and also to break out of the loop if run_again == false. > > > > > > > I picked the most compact variant to demonstrate the problem. Adding > > breaks isn't > > really helping the readability. > > > > for (i = 0; i < 2; i++) { > > run_again = false; > > /* bunch of code that possibly sets it to true */ > > ... > > if (!run_again) > > break; > > } > > if (run_again) > > blk_mq_run_hw_queue(hctx, true); > > > > When I read this, I initially assume that the loop in general runs > > twice and that this is the common case. It has the > > same problem with conveying intent. Perhaps, more importantly, the > > point of using programming constructs is to shorten and simplify the > > code. > > There are still two if-statements in addition to the loop. We haven't > > gained much by introducing the loop. > > > > > BTW, I share your concern about the additional indentation by eight > > > positions. How about avoiding deeper indentation by introducing a new > > > function? > > > > If there was a benefit to introducing the loop, this would be a good > > call. But the way I see it, the introduction of another > > function is yet another way in which the introduction of the loop > > makes the code less readable. > > > > This is not a hill I want to die on. If the maintainer agrees with > > you on this point, I will use a loop. > > I haven't done a massive amount of analysis of this patch, but since I > noticed it while debugging my own block series I've been keeping track > of it. Is there any status update here? We've been carrying this > "FROMLIST" in our Chrome OS trees for a little while, but that's not a > state we want to be in long-term. If it needs to spin before landing > upstream we should get the spin out and land it. If it's OK as-is > then it'd be nice to see it in mainline. > > From the above I guess Salman was waiting for Jens to weigh in with an > opinion on the prefered bike shed color? > > -Doug