Received: by 10.192.165.148 with SMTP id m20csp2865232imm; Mon, 7 May 2018 02:28:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpsOH1QkVyX9R0GSX4cJO6947Ll8M5mRTkNBn/YVgJysiMcKTZSUajV7sALFzJzbcYnXUy/ X-Received: by 2002:a17:902:362:: with SMTP id 89-v6mr38087191pld.270.1525685302639; Mon, 07 May 2018 02:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525685302; cv=none; d=google.com; s=arc-20160816; b=VJ4VF8wCEMLNFMEnnasUVInnF9clecN8cDRuXFewbByA+TeHJMJmyi+J4rngmqBXMX asetX8yHJyyVc6EJZBWrPU7mlOIoQfRTxBDXxL9vtamyXm9EJcUm5kHJ1dasLNWu2xhA GGMexy95VhS1HMlc/WmJ1rTW0s9atnFkXGbYbrDJ0JJOMdjrZyGpUVHXtQZUpeTU2QV+ uJGAX8KADk0M6FZeBAmQbo0cAJgCI75Z/lxz33+AT4X9US3s1xxfuErqA73Nt9ers4jM 1IzZU0xqaR1wJAJPrqr1XezSa2x+8D2qB4J91QFYRtlGXfLkF4wfmVSMrm8RK7XFA3F1 DlbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=oTwTO4TlmbmDSsHsY7x6ZHvYwqbnmzboCiZYk685LW0=; b=olwsdtHHsUITHBPctuXbLekwTNMr82wu8BKFMFTqeaZVW5cOS1lLHKg/foKNuxXQrz +W0CHiWO1CK0DYMeMqc1PMD+QAAY3KqjgLazMtuXo+p1pqZOqCGnHgx703d6vSZOxA9J eYY1FKKOrNEtDtl/uTTQokum1qasyKz5uTDKqQnRJxwH/VtGrLvvxS6AI/sw1CaUHI5J eq84bPnOM1xTViAW+OzLTC2nl3A/psnpNsQFIoJcoZ5R7HDc26zsTnXkh2J5d0snGOh4 eWOIssYeYR2Vz10DWK6HpB3ewUNhfpEf5z0zQoaVFRgRg3jgeyaC6mZVb82OXc3VnvWq bHGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dW6efXTd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3-v6si11334268pld.45.2018.05.07.02.28.08; Mon, 07 May 2018 02:28:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dW6efXTd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752131AbeEGJ1d (ORCPT + 99 others); Mon, 7 May 2018 05:27:33 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:41397 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751830AbeEGJ13 (ORCPT ); Mon, 7 May 2018 05:27:29 -0400 Received: by mail-wr0-f195.google.com with SMTP id g21-v6so27991600wrb.8 for ; Mon, 07 May 2018 02:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oTwTO4TlmbmDSsHsY7x6ZHvYwqbnmzboCiZYk685LW0=; b=dW6efXTdzEApYKO1UaJkoVOdW2NqcX85nZeSltbHOOuBAKr49daKx1Pe6oYIrv7Ux7 pI7mtqgfNOR9arPLoJOWlc4VeY9BgWWFgW7Cf1D67hrPwzus64KFurKadnELyoDp1uVm d9QIkiJxcDrHZz7bxkLeukLXm0jCAUe7KAmD0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oTwTO4TlmbmDSsHsY7x6ZHvYwqbnmzboCiZYk685LW0=; b=D5pSA2kTxnZdcccGyJxEl3K3BASadxU5gEoGkX672hJqgqv3GUYc5PI3TXv7xaHiMv Q16UtnOVDusV0virXwEXczo6h/g7ha/qE48YxK6gjgk+e6XbAsDpk732E6pM/w/JY2iB hzrFnb48jpjxtcKRqjEL/ynlDka8cx4cktQ75EemJpm186P0oHB0JzX8kGTaXeC6RBTJ pHUfvufgV/nQ6nTfElFT8i+c3g2GobdRIX+Zz8VfZ7MTyLeijRFa0gD4g+VRxrwFFq9+ m11UaSXux32HzGabmyQ+n1CknGmEm8xH6+EBHF+IHbyYUYH5DICdp+eabt0/rOxS0ep7 8/PA== X-Gm-Message-State: ALQs6tD7Bm95xxJiumt6UPi/QWi/w60+fzKd1TokD+FepiCOPGR+CjWH 6vyxMMr8Pr3MT5HfSdeKAqMCIA== X-Received: by 2002:adf:a970:: with SMTP id u103-v6mr27776990wrc.71.1525685248261; Mon, 07 May 2018 02:27:28 -0700 (PDT) Received: from [192.168.0.104] (146-241-57-124.dyn.eolo.it. [146.241.57.124]) by smtp.gmail.com with ESMTPSA id i26-v6sm6107533wmb.19.2018.05.07.02.27.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 02:27:27 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH BUGFIX] block, bfq: postpone rq preparation to insert or merge From: Paolo Valente In-Reply-To: <1525672597.5064.3.camel@gmx.de> Date: Mon, 7 May 2018 11:27:25 +0200 Cc: Jens Axboe , linux-block , LKML , Ulf Hansson , Mark Brown , linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name Content-Transfer-Encoding: quoted-printable Message-Id: <1723D46D-579A-4C5A-BCC1-6ABAA6E7C3FB@linaro.org> References: <20180504171701.6876-1-paolo.valente@linaro.org> <1525463210.622.1.camel@gmx.de> <1525508378.5406.6.camel@gmx.de> <9F155F9F-F6B2-465A-BA4D-A86FF6825071@linaro.org> <1525532191.5406.15.camel@gmx.de> <223CABEA-71E0-426F-A4AB-17BA8437C978@linaro.org> <1525672597.5064.3.camel@gmx.de> To: Mike Galbraith X-Mailer: Apple Mail (2.3445.6.18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Il giorno 07 mag 2018, alle ore 07:56, Mike Galbraith = ha scritto: >=20 > On Sun, 2018-05-06 at 09:42 +0200, Paolo Valente wrote: >>=20 >> diff --git a/block/bfq-mq-iosched.c b/block/bfq-mq-iosched.c >> index 118f319af7c0..6662efe29b69 100644 >> --- a/block/bfq-mq-iosched.c >> +++ b/block/bfq-mq-iosched.c >> @@ -525,8 +525,13 @@ static void bfq_limit_depth(unsigned int op, = struct blk_mq_alloc_data *data) >> if (unlikely(bfqd->sb_shift !=3D bt->sb.shift)) >> bfq_update_depths(bfqd, bt); >>=20 >> +#if 0 >> data->shallow_depth =3D >> = bfqd->word_depths[!!bfqd->wr_busy_queues][op_is_sync(op)]; > = ^^^^^^^^^^^^^ >=20 > Q: why doesn't the top of this function look like so? >=20 > --- > block/bfq-iosched.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > --- a/block/bfq-iosched.c > +++ b/block/bfq-iosched.c > @@ -539,7 +539,7 @@ static void bfq_limit_depth(unsigned int > struct bfq_data *bfqd =3D data->q->elevator->elevator_data; > struct sbitmap_queue *bt; >=20 > - if (op_is_sync(op) && !op_is_write(op)) > + if (!op_is_write(op)) > return; >=20 > if (data->flags & BLK_MQ_REQ_RESERVED) { >=20 > It looks a bit odd that these elements exist... >=20 > + /* > + * no more than 75% of tags for sync writes (25% extra tags > + * w.r.t. async I/O, to prevent async I/O from starving sync > + * writes) > + */ > + bfqd->word_depths[0][1] =3D max(((1U<sb_shift) * 3)>>2, = 1U); >=20 > + /* no more than ~37% of tags for sync writes (~20% extra tags) = */ > + bfqd->word_depths[1][1] =3D max(((1U<sb_shift) * 6)>>4, = 1U); >=20 > ...yet we index via and log a guaranteed zero. >=20 I'm not sure I got your point, so, to help you help me quickly, I'll repeat what I expect the code you highlight to do: - sync reads must have no limitation, and the lines if (op_is_sync(op) && !op_is_write(op)) return; make sure they don't - sync writes must be limited, and the code you pasted above computes those limits - for sync writes, for which op_is_sync(op) is true (but the condition "op_is_sync(op) && !op_is_write(op)" is false), the line: bfqd->word_depths[!!bfqd->wr_busy_queues][op_is_sync(op)]; becomes bfqd->word_depths[!!bfqd->wr_busy_queues][1]; e yields the right limit for sync writes, depending on = bfqd->wr_busy_queues. Where is the bug? Thanks, Paolo > -Mike >=20 >=20