Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3804311ybz; Mon, 20 Apr 2020 09:44:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJEqCj6O8MxvmxXFWrVjRU8qZ31L+TNrOBeOyxi6xbUSlIXe0TZTPEFSanHmRDoHn6iSRcp X-Received: by 2002:a05:6402:356:: with SMTP id r22mr15651340edw.3.1587401072169; Mon, 20 Apr 2020 09:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587401072; cv=none; d=google.com; s=arc-20160816; b=qpCSJLaQTuRlEvP3XqqQOtqUBH1PYRoQJdcsDhMSKHpgKPwOHrb4lcu95TZv5eaR5W 6XpZm0Lo134AL6T7PgaZZJAgI1LRTX0dI5eG/ZHxICPWdXocI4cllUZPT0afRL4tkMVc FNkXDcibFAEgALl0whUMsSIvIFLAApyZLhMzZRmjVIegYL3IBITLeYdvPfxLlKAhSrU/ a5yfm5vdR2MCltP1sJLBCMLrHPLEipNwUGIYZ4d9ZBB5Qw1fpvOiwEvdRR7W2eoQJTT7 xaMoxEyalFZqVdst/25C4rzfwcCFlVzt5EXZswRvU9qNZMhWDLxIuhNZUnxcMlYySnyG Ipmg== 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=5wfQZpU1iI1W+9vUazFL8ggsPgPoMXhj1yc+iZAGVvU=; b=H+w1PCm9jV5o8/XvtuMlTiK4z1yIEqOpeHGXTzg9GaO8KvOtJbOIDWVCZzO+7ok97n t29W4Jk9r019xoRi0cwd2Bvvr0dFBXCmpEyYyuLfmI/mX7oDto7/iv2ERuzgGJXbO1+a IM7CraKcxhOUMPVJWgO6VeYZdnJH9QgetiBWaGB+MX/RZELFNiaiMPCXDMZoPnb25/pj 23/7N1hQL61T+ApkukRrSDUzJ0ySB7xf7tnbH2zI0NBfmVqjUqdEuihvxwbwlXg0/Zq2 HAzQNH39tRUg2W8Hiew3n4mrdicjcz0YLJfialAGoKY0LJ19Gy9LUyV1VT7d/a2UXJxo C5Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="W/+0d9rw"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dh5si822835edb.577.2020.04.20.09.44.09; Mon, 20 Apr 2020 09:44:32 -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=@chromium.org header.s=google header.b="W/+0d9rw"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726662AbgDTQnF (ORCPT + 99 others); Mon, 20 Apr 2020 12:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726517AbgDTQnF (ORCPT ); Mon, 20 Apr 2020 12:43:05 -0400 Received: from mail-ua1-x943.google.com (mail-ua1-x943.google.com [IPv6:2607:f8b0:4864:20::943]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04C26C061A0F for ; Mon, 20 Apr 2020 09:43:05 -0700 (PDT) Received: by mail-ua1-x943.google.com with SMTP id g10so3899449uae.5 for ; Mon, 20 Apr 2020 09:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5wfQZpU1iI1W+9vUazFL8ggsPgPoMXhj1yc+iZAGVvU=; b=W/+0d9rwb/nWJkvnAmRWlU6TQZcm39G3hJCW0eq+m8LkMuHRjF/LuQ0FrI01XDpGsR q8vpSxItKzuEVk/3dJdfK8awZDCrXHT1C9MYqAcoJUrpdAyNUqut4npO8hJImjb/bfNv Q4TEPuPqY//QFKOAIP6124jXGPGAqMBMer3ec= 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=5wfQZpU1iI1W+9vUazFL8ggsPgPoMXhj1yc+iZAGVvU=; b=DhGB4/Jt7RZMbk9qgYa7WNgscdgZFg3qrIJ2kmLuaSXcqWkTXiYbbPn+8Hp5ur3ru4 I9APAcPtnBpzIf/3nARwsdAQ4Mn2Hja0xg5KNgZcA7/qKKTM7M3Pxcdxlbrw6JLevxFk 53heJ3EqOconx8+5hvOiNqwrefAcmmB5JdtW765ocgCnB2PSVLRKvak/ikWqg7YDIM7o JWA+lmtY4LSNQJQVUQMW7nxWrNqJePC5uUcwyJfxJJkmqVQaqWI7dc3HKXMovymWBnTk WEyuBh/Vmf/btdWZfPhez9rc8uD2MuqIXR25Mplsixs0slUi4VALLAP40G8YrIR4V5Iy qBZQ== X-Gm-Message-State: AGi0Pua37GuInyfiXdFpJO713TEZ2Xy4pdiys4DDltHykvPzHinWcCiD +W4gpHQVVsr2WovFQ4hqP9ya5kj2juQ= X-Received: by 2002:ab0:2544:: with SMTP id l4mr8479319uan.66.1587400983359; Mon, 20 Apr 2020 09:43:03 -0700 (PDT) Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com. [209.85.217.44]) by smtp.gmail.com with ESMTPSA id s134sm336173vke.46.2020.04.20.09.43.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Apr 2020 09:43:01 -0700 (PDT) Received: by mail-vs1-f44.google.com with SMTP id h30so6005153vsr.5 for ; Mon, 20 Apr 2020 09:43:01 -0700 (PDT) X-Received: by 2002:a67:c40c:: with SMTP id c12mr2547643vsk.106.1587400980801; Mon, 20 Apr 2020 09:43:00 -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: Doug Anderson Date: Mon, 20 Apr 2020 09:42:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] block: Limit number of items taken from the I/O scheduler in one go To: Salman Qazi , Jens Axboe Cc: Bart Van Assche , Ming Lei , linux-block , Linux Kernel Mailing List , Jesse Barnes , 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 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