From patchwork Thu Aug 22 15:20:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11109593 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01A461813 for ; Thu, 22 Aug 2019 15:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D526C23407 for ; Thu, 22 Aug 2019 15:21:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="auiCoSvI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389161AbfHVPVU (ORCPT ); Thu, 22 Aug 2019 11:21:20 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55764 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389039AbfHVPVB (ORCPT ); Thu, 22 Aug 2019 11:21:01 -0400 Received: by mail-wm1-f67.google.com with SMTP id f72so6040774wmf.5 for ; Thu, 22 Aug 2019 08:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ELMpUJexjYTcd7MhQ08SZVf3kBnnCO4/j3IIYq4skds=; b=auiCoSvIyq9JJI/w/E0uM+TRpA3m+MgN3krMgBBSdol/QQxKZ1xBWl1/XruqMlaJLy wtumBUU817GQWPaHUTA4uAKD3/3KDW4vOK/fqNLuDTT8nL6UrxK/U8zc5rwzkr510h+R WxH9vikEsZ7u89kG8VRlWLg9zbWcKCCmyNhTGoGUGXVgmJB94PyGH5OXjfGWBN2R3R1d LJI6ecAc9veuZj75CnL4Hj0xKW22bvT0knnGZ82n3utvhrGMmS0El4OPG/Tm3hT8v3iN yWCq4mVnVxYh4kddPRj8eXR7VhgsWBadW7N6s9LBQa48GbpGrHN/RTCLXo9hyDKJHjVd 7OhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ELMpUJexjYTcd7MhQ08SZVf3kBnnCO4/j3IIYq4skds=; b=THqOiGbeszygXQk7Yl6/FdMTFObt9d/iklKJ5uUPOKvE5NdswnYQPvWrZVpSCKxLUL 48UMbBWNUe2BP+sOHr7M+dF1n1lFPhnBKYe4baUWKp93sDyzqVdtCJszVXBPbM114YZt e81T00VWAzWCyesPFCWu6GIyuRYU2KwknCFQdmybZh3X0KApoh2v3XKIQFvSZ7gI3Ulv TwrzJP0aS8BXtB2zkvQiW5JRcPAtAg3fHN2vO8NaCanR1SSPCcazFtB+uJXKTPcN2eN+ 8X4QduDQXDLVOU6XqSxz5N6Mq6le4LZ4JQeC/QlsJlZyXBXYc90rTm90EdTEol/UMHnq ZqRg== X-Gm-Message-State: APjAAAWOWb8Nn7fEG8QRJsJaVYOjXmz1SmLoEvQzsQyYB5plrD6AyGSu z4/5UeV5A9rQUEx9aeOSgZeVbA== X-Google-Smtp-Source: APXvYqwAwov6sEvyu4LBSFiaSToGiE2k5CeC63VtD8WpA/0WtqYyfTL12TWXaSUmeZ+ldncsYt7BEw== X-Received: by 2002:a05:600c:d9:: with SMTP id u25mr7254091wmm.26.1566487260240; Thu, 22 Aug 2019 08:21:00 -0700 (PDT) Received: from localhost.localdomain (146-241-115-105.dyn.eolo.it. [146.241.115.105]) by smtp.gmail.com with ESMTPSA id a19sm79833974wra.2.2019.08.22.08.20.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Aug 2019 08:20:59 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, Paolo Valente Subject: [PATCH 1/4] block, bfq: update inject limit only after injection occurred Date: Thu, 22 Aug 2019 17:20:34 +0200 Message-Id: <20190822152037.15413-2-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822152037.15413-1-paolo.valente@linaro.org> References: <20190822152037.15413-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org BFQ updates the injection limit of each bfq_queue as a function of how much the limit inflates the service times experienced by the I/O requests of the queue. So only service times affected by injection must be taken into account. Unfortunately, in the current implementation of this update scheme, the service time of an I/O request rq not affected by injection may happen to be considered in the following case: there is no I/O request in service when rq arrives. This commit fixes this issue by making sure that only service times affected by injection are considered for updating the injection limit. In particular, the service time of an I/O request rq is now considered only if at least one of the following two conditions holds: - the destination bfq_queue for rq underwent injection before rq arrival, and there is still I/O in service in the drive on rq arrival (the service of such unfinished I/O may delay the service of rq); - injection occurs between the arrival and the completion time of rq. Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index b33be928d164..5a2bbd8613a8 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -2025,7 +2025,21 @@ static void bfq_add_request(struct request *rq) * be set when rq will be dispatched. */ bfqd->wait_dispatch = true; - bfqd->rqs_injected = false; + /* + * If there is no I/O in service in the drive, + * then possible injection occurred before the + * arrival of rq will not affect the total + * service time of rq. So the injection limit + * must not be updated as a function of such + * total service time, unless new injection + * occurs before rq is completed. To have the + * injection limit updated only in the latter + * case, reset rqs_injected here (rqs_injected + * will be set in case injection is performed + * on bfqq before rq is completed). + */ + if (bfqd->rq_in_driver == 0) + bfqd->rqs_injected = false; } } @@ -5784,7 +5798,7 @@ static void bfq_update_inject_limit(struct bfq_data *bfqd, u64 tot_time_ns = ktime_get_ns() - bfqd->last_empty_occupied_ns; unsigned int old_limit = bfqq->inject_limit; - if (bfqq->last_serv_time_ns > 0) { + if (bfqq->last_serv_time_ns > 0 && bfqd->rqs_injected) { u64 threshold = (bfqq->last_serv_time_ns * 3)>>1; if (tot_time_ns >= threshold && old_limit > 0) { @@ -5830,6 +5844,7 @@ static void bfq_update_inject_limit(struct bfq_data *bfqd, /* update complete, not waiting for any request completion any longer */ bfqd->waited_rq = NULL; + bfqd->rqs_injected = false; } /* From patchwork Thu Aug 22 15:20:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11109585 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64FE21399 for ; Thu, 22 Aug 2019 15:21:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43A35233A1 for ; Thu, 22 Aug 2019 15:21:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WxubH5IM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389563AbfHVPVF (ORCPT ); Thu, 22 Aug 2019 11:21:05 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:33242 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389542AbfHVPVD (ORCPT ); Thu, 22 Aug 2019 11:21:03 -0400 Received: by mail-wm1-f68.google.com with SMTP id p77so7326681wme.0 for ; Thu, 22 Aug 2019 08:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WfflNsfWkOa6pDM4wMxWMhDSV9/CiHm7eu3wCLgDzBU=; b=WxubH5IM9oW568/MgT51L+h21Si3KP9c61YYF5GvYWHjdbSIuOZ/m/Eaaie57qoBBH V8hSlixmGOC65GsJmPd0C0vMwWXjyj//eDWScbbXZcZXMyjj6HUdLfXM0lcLyGXG8Oqx GJ5rTPeme/pt21MuzMB/06hQvsegWX/XIxG2MNuRJH8fRCO+IuzLj5xORN4EeKkzY48R 4RnlHXhbuoU8FIWuXnY4575N6dAbeh1VsRMp2bxkHFnqempkE3COghjTH+usytRicBXD p227kQctSISa0SnIurmQfANjWM7hT0+E7Ave92JZVbMYqRwBv8syEH+nUGekI7pIrdhA hhxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WfflNsfWkOa6pDM4wMxWMhDSV9/CiHm7eu3wCLgDzBU=; b=C8iF8WdrWiCWLLg1LPLOhxbID9DXX9kKT1JbcpGYIpIrtoZQMhMbIhxIcAmSfhreiQ VF5EuM18THgxzpyD21or6/PsL8uRaXR0DgQcf/5ttEG+lFnGPSE7NObQePEz+N5SUuem AxY6mnEH0CsAe89btrOwh4ytWgIQjM1gA184VKzzvp1IH6YTZBQXAw5BAE769rG+LGRr WVn+tpugDKlTps+92o01S447OHRHWNNUSGmVCoUG6TmifMT41CgOVHkb117W/rsVggfR XY5zAZqM2Rn/CzW+3q7r8yWay/wSenxU98AYoXq3CsYRbxi5/H3SjdpI3B+0kFt7khMp VJ4A== X-Gm-Message-State: APjAAAUv4s0XEfvaMdowZDcKBo2bw4wC3PxwD64ycwV/wfC5axMzF+rQ QZm/8NO6E5ESPTRCpuuVFVBixg== X-Google-Smtp-Source: APXvYqzMaMgyUxed5nIeBrM7zPfQoFGPc2dhGkxbotpKunfDdfJiEfwav0xtWpFhMC6k+tofaFqNFA== X-Received: by 2002:a1c:a70d:: with SMTP id q13mr7343210wme.26.1566487261463; Thu, 22 Aug 2019 08:21:01 -0700 (PDT) Received: from localhost.localdomain (146-241-115-105.dyn.eolo.it. [146.241.115.105]) by smtp.gmail.com with ESMTPSA id a19sm79833974wra.2.2019.08.22.08.21.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Aug 2019 08:21:01 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, Paolo Valente Subject: [PATCH 2/4] block, bfq: reduce upper bound for inject limit to max_rq_in_driver+1 Date: Thu, 22 Aug 2019 17:20:35 +0200 Message-Id: <20190822152037.15413-3-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822152037.15413-1-paolo.valente@linaro.org> References: <20190822152037.15413-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Upon an increment attempt of the injection limit, the latter is constrained not to become higher than twice the maximum number max_rq_in_driver of I/O requests that have happened to be in service in the drive. This high bound allows the injection limit to grow beyond max_rq_in_driver, which may then cause max_rq_in_driver itself to grow. However, since the limit is incremented by only one unit at a time, there is no need for such a high bound, and just max_rq_in_driver+1 is enough. Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 5a2bbd8613a8..e114282204f6 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5805,7 +5805,7 @@ static void bfq_update_inject_limit(struct bfq_data *bfqd, bfqq->inject_limit--; bfqq->decrease_time_jif = jiffies; } else if (tot_time_ns < threshold && - old_limit < bfqd->max_rq_in_driver<<1) + old_limit <= bfqd->max_rq_in_driver) bfqq->inject_limit++; } From patchwork Thu Aug 22 15:20:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11109589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50EE71813 for ; Thu, 22 Aug 2019 15:21:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F3E723401 for ; Thu, 22 Aug 2019 15:21:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="x15ajMuF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389558AbfHVPVF (ORCPT ); Thu, 22 Aug 2019 11:21:05 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54328 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389040AbfHVPVE (ORCPT ); Thu, 22 Aug 2019 11:21:04 -0400 Received: by mail-wm1-f68.google.com with SMTP id p74so6034702wme.4 for ; Thu, 22 Aug 2019 08:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V/3hIve56TY3nPZuccDF0XScvmoR85KKgvEdDQPL/bY=; b=x15ajMuFW8CBP6Ko+tieGCodba9xi+nKg0uU130qGB/0AsMLTk7urKVBk2TvKyQbsP 8eYi066CDFpPZTv92qUgfwveDdWeg5ZvMmndvKnt3/rBYG00Ki7965Gwv/B7/KeGOUfZ hROJzc6XjdBGMTZY9oNeNCJdTbgDo4/5+4MNYMA+sHeLlwPL8HeFE7Zyaen/f/Y+x2Ap pA82W5AU+LX5cxhZwUXARXQfBIeJbnptBQVGCgcqGBaegBNZ4iXnatQuMDI5yYtN/pWU 3beqY7Bt2PEjSNKWfieDFMdLYw+tSNxj7+9txR1qynN4PcOa2ZXJtlhlBWUwhWjry+04 tfWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V/3hIve56TY3nPZuccDF0XScvmoR85KKgvEdDQPL/bY=; b=chm8EZkJ8L6uJYW4qpHM8S7BO/d6G+HoZq8d6i2gfya8NKgXl5yFCBmnbzdO18txd5 iSy14VwBjFrCOPlpu3std1mFqvLgloUe+O5OQ9VMCv7MH6wGCg69vml0NIU14wYF57K/ Du4Ears4TsqdT0YpYdUh7ZgGbOJ+XOoIN18+7c023QF3IRNcbL4L56N2r0YsBwhXMLcR 7/Zt3z3W96z7d3x/pN27gAkpcj2vZfzI0WlShTypUDZKM+fF+koplFB9cHwiUZyCjHPA xVatgluD6uFF1QVADwCyh4JsNWIuVkrzimiBvERa6D9pQHE/Ol3xF4t0u98DvSmjbCtD g1KQ== X-Gm-Message-State: APjAAAXifntjHGBnK6sAYWiXHbYRKzpvrRI7V8lVq7Hdzbh81zZHkJD3 0jnT73OWZ9RktduL4Uk0R9Mimg== X-Google-Smtp-Source: APXvYqx2AJWIy5rwYlpsVlzyIWsz9lY5cwcjUoA/zzfv53V5+toUk2ADJp3ZZOKSBp9RU/RVU9wrtw== X-Received: by 2002:a05:600c:204:: with SMTP id 4mr7433884wmi.167.1566487262553; Thu, 22 Aug 2019 08:21:02 -0700 (PDT) Received: from localhost.localdomain (146-241-115-105.dyn.eolo.it. [146.241.115.105]) by smtp.gmail.com with ESMTPSA id a19sm79833974wra.2.2019.08.22.08.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Aug 2019 08:21:02 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, Paolo Valente Subject: [PATCH 3/4] block, bfq: increase update frequency of inject limit Date: Thu, 22 Aug 2019 17:20:36 +0200 Message-Id: <20190822152037.15413-4-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822152037.15413-1-paolo.valente@linaro.org> References: <20190822152037.15413-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The update period of the injection limit has been tentatively set to 100 ms, to reduce fluctuations. This value however proved to cause, occasionally, the limit to be decremented for some bfq_queue only after the queue underwent excessive injection for a lot of time. This commit reduces the period to 10 ms. Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index e114282204f6..ddac93e910fa 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -2016,7 +2016,7 @@ static void bfq_add_request(struct request *rq) (bfqq->last_serv_time_ns > 0 && bfqd->rqs_injected && bfqd->rq_in_driver > 0)) && time_is_before_eq_jiffies(bfqq->decrease_time_jif + - msecs_to_jiffies(100))) { + msecs_to_jiffies(10))) { bfqd->last_empty_occupied_ns = ktime_get_ns(); /* * Start the state machine for measuring the From patchwork Thu Aug 22 15:20:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11109587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A172C14F7 for ; Thu, 22 Aug 2019 15:21:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F11123400 for ; Thu, 22 Aug 2019 15:21:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CPtPkL7r" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389040AbfHVPVF (ORCPT ); Thu, 22 Aug 2019 11:21:05 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38733 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389555AbfHVPVE (ORCPT ); Thu, 22 Aug 2019 11:21:04 -0400 Received: by mail-wm1-f66.google.com with SMTP id m125so6184235wmm.3 for ; Thu, 22 Aug 2019 08:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dQo/3gCQPUZclinUkVyhVJImer3HlnMgJva1KNL7p2s=; b=CPtPkL7rqtuuqAFgy+uhFEw2Nx8tcwkjur3v/fj0Adcr4K8/+LteVFwtZIl5s++8GK 6LInXMWdf7WoaVYbrfrOWZQKfRU5uAw1gR/f1UuVhuGxkizCnYXhvtqzlm3HU/kuWrWw XPUWMGwuLQ51wWbkPpXxXa3aeSuqHwiSpEOZvZTHaI4KXRRGsl9a0hTCDumOcFj3OQbf p8wIRavzYFIeRoSPkXhQhkcAtdqPh7I64AWh8IEV8c/WjqpSYj+Xl180r4y8hO2oRyLe AU1ws1HIxNV3oaFTaa8hR2Z5PsZ77+sbGNq+svtVGpbGy6nXkaZWliogDeh33zV3CZNx 5Zmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dQo/3gCQPUZclinUkVyhVJImer3HlnMgJva1KNL7p2s=; b=Ij03YxUfngv/mO+mAqWUwkqTHNWC/sN4dZxkez+U4WPXxa4mO3rvxgIt58qHVbDOA5 oJqs+1SkDpRAGTF0rFrQtzdIxICLLao9sBs2a8CEz/X3wBpC2r2D+NTYPftWqOfesQLN 80Q3Qi2mMRWyzTSF0+ZQ8Z8SZVAA8ieDD/NoP/z55y74P2ypSrEQYn8NBl3li+ESTAWO dA6WPhj6T2a5WqBkOlsa12EaWEbyjwn+gw/DqJFFA6FdLGUCm7TbVtlXUXXhE+K/eEF8 206d+gbSJA93mZhgphUg6ohIdqohT2J7ZEic8OnHyTpqbb0GpcOUlhuE09iWts8T93WQ EVWw== X-Gm-Message-State: APjAAAVn8eag8xTtkPH/4LV1g8Fj9tw60c+LnmU5AIgi6u012w7eLvCg bfIWVHAqoJqfgcWOEJlJdRBIaA== X-Google-Smtp-Source: APXvYqx+RPajfN/Z+9lgie4Z+FxDwW+FRUhfHznXuS+cA2uc391gatlhFjJt2iECdWeyjhf9diV00w== X-Received: by 2002:a7b:c246:: with SMTP id b6mr7330814wmj.13.1566487263542; Thu, 22 Aug 2019 08:21:03 -0700 (PDT) Received: from localhost.localdomain (146-241-115-105.dyn.eolo.it. [146.241.115.105]) by smtp.gmail.com with ESMTPSA id a19sm79833974wra.2.2019.08.22.08.21.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Aug 2019 08:21:03 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, Paolo Valente Subject: [PATCH 4/4] block, bfq: push up injection only after setting service time Date: Thu, 22 Aug 2019 17:20:37 +0200 Message-Id: <20190822152037.15413-5-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822152037.15413-1-paolo.valente@linaro.org> References: <20190822152037.15413-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org If equal to 0, the injection limit for a bfq_queue is pushed to 1 after a first sample of the total service time of the I/O requests of the queue is computed (to allow injection to start). Yet, because of a mistake in the branch that performs this action, the push may happen also in some other case. This commit fixes this issue. Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index ddac93e910fa..0319d6339822 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5823,12 +5823,14 @@ static void bfq_update_inject_limit(struct bfq_data *bfqd, */ if ((bfqq->last_serv_time_ns == 0 && bfqd->rq_in_driver == 1) || tot_time_ns < bfqq->last_serv_time_ns) { + if (bfqq->last_serv_time_ns == 0) { + /* + * Now we certainly have a base value: make sure we + * start trying injection. + */ + bfqq->inject_limit = max_t(unsigned int, 1, old_limit); + } bfqq->last_serv_time_ns = tot_time_ns; - /* - * Now we certainly have a base value: make sure we - * start trying injection. - */ - bfqq->inject_limit = max_t(unsigned int, 1, old_limit); } else if (!bfqd->rqs_injected && bfqd->rq_in_driver == 1) /* * No I/O injected and no request still in service in