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: 172028 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1036502ily; Thu, 22 Aug 2019 08:21:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzI6e/Si5JHCHYYtK1PtIPYsSdxy4t8GqK6xI5Y8cEi0nI/oSgV1kXTG5nDsVB9oyPslQA2 X-Received: by 2002:a17:90a:cd04:: with SMTP id d4mr216068pju.70.1566487264313; Thu, 22 Aug 2019 08:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566487264; cv=none; d=google.com; s=arc-20160816; b=Q9OtLUKUEY27ehawv+MizaIk9KJ1V6uotQEEXYMeXP7rNCOpEbBbUNk29GU0/4TSJD cBxAdiiJN18IAivmZIl7+MtiVyIpm6EDi33c0tWl9Y5APlScM7yrnuWq7VKrhHscj/B0 xARSh+a9qaUmnTfX3iruz+5LwppLBFKhxHfVrxNe1Iqk9nu91UYloQVF2HOjbo1XLvE2 mIxVsGMAV8EB23hjETtNvdohlnlPLBAmPXGrNJ754baMmWU2t9H86I9W5QQrHIfYxo45 AL3fXAXTHhyN9R+ZHhokppnrwL33nXaONDTUdh8rybktaKrCDkmvDf8H3VZxTeOZPT6U 6Grw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ELMpUJexjYTcd7MhQ08SZVf3kBnnCO4/j3IIYq4skds=; b=vGWIMzIr8L7Q8ZSbvr02Q3iyuqq621x1trwQIqZr47fscNCleZiiksmeJXvhTA6fXb +cwHm8QyTJb/9va6gUitVpFn6XvzQ7gJ2Y5iQDU4ZbZUPLfRJrlpoBVx5DxxZ65sRNzC JEcXwP5+vAUEyjEaan3CvB4uJtPZwUWK1svc82ReAC5QdbZ0h1muQVjzo3M3cr/I2cI2 jzCxL5IWSTkeJlOFpqAiU6QSLNs0IChy+DvQdtISmtctFoppCE0MwhRv03ezlbUxTK9+ vV9wM9fV5nx5EU+6HlgHFnn1oNm+5VO5xK2pzESJd0FA2Keae5iIz5DTzS+S/iOse1cx BiLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=auiCoSvI; 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 19si18169189pfc.239.2019.08.22.08.21.04; Thu, 22 Aug 2019 08:21:04 -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=auiCoSvI; 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 S2389552AbfHVPVC (ORCPT + 28 others); Thu, 22 Aug 2019 11:21:02 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34118 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389040AbfHVPVB (ORCPT ); Thu, 22 Aug 2019 11:21:01 -0400 Received: by mail-wm1-f66.google.com with SMTP id e8so7328758wme.1 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=P1wwMdBp+SUEVFRrdGyTF522weLr3loOdtoHtuKCc+M0B63JZ2jFM67aSL50u0KCdS dABNE/Fm/p7ZTgAzkc9yQQFsmIm5xAPJxq/5BfO2lg7CqrmkjNfC0F1aRT4ESxfqEBC5 oln3DggV1RBbxWw6dJgcJ+5BN9otUGQ+qNpcmgdGn8qp5dHYEueVDfs78ybKYQyP7EFd 6cb5YO9FFsiW0s4UgRJicl58hTOvBuZquyBxx/wWUfDk1G3e//LrmBi1MPOIwVsQH0pm n3nMt2+YHO5O85ZWWyjuMiJiM4GVVUvdcP4LLuBGyTkyFzy4CKv601tLW3QvN6Uer2gJ kRZw== X-Gm-Message-State: APjAAAWsqEm8E1X/1PH98Bc3LisyaBS6/wM8AhLnAkOlDz8OVHel4z3/ SFvhbsxJgCto8mV4OLgt+5D2vg== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) -- 2.20.1 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: 172029 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1036581ily; Thu, 22 Aug 2019 08:21:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6QzgvcdIkhGHECb6xo2ORcbSeakE0ekdPOQy90hBMLPqXV1WrmT5F9gcw4t6pEuiE7KBU X-Received: by 2002:a17:90a:cc13:: with SMTP id b19mr153005pju.117.1566487268310; Thu, 22 Aug 2019 08:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566487268; cv=none; d=google.com; s=arc-20160816; b=MfOPsutYiWid7yjuRI4BQq3qMRmGwiu3bsasY6tXbZczDsH+lqaw4RgYwx7cPC66cW aGuRK/XL6uAvgAuC/OQM9mNk03oseFQ33s6oDQJ282m4eWZHYV0uS/3ZdUQfu6Noxn6W 9i65CzUZmAtk7EWHtZ37KkhQ17ZCldlRCZaOilp4f7Lg9TWNJRd9x0nm+f3CuqMuFP+z es+YOUGCnr1RBSLSieF1eSsPX2GyeKWc2LxaelMe12jN+ARJnnwDNs3rp7EMZSpdtXO8 I5n+YZtXXymtsJKw5X4dcFSyaeV+hkLcBiYTxCjUW7IyhNCUJR2+yWoYpS/SMmb78y7u XlIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WfflNsfWkOa6pDM4wMxWMhDSV9/CiHm7eu3wCLgDzBU=; b=xja7pqJO6vdZXdkvxs0+LyWrFbwRRSFZKLye4VSCM0RlB7W828MSrYi1Sei49/MKKX WJmx1kgbg/7YILAqqS9z0yJXj+QBdr0naOCnLuhGysZJLvjaACjAgv2PQM9DIbekPJu9 oVHff+yZhfaMXzNo++K6GQ44Jy4WZ6XGkLinDTN3YvpLgt2GroUg1C+pIbIuvjhjr4bU 2BuNFNw1nInVwvT7Z4tah6mq2JJJwQKuhF0ykr+XLGGW+Db9rgQB4T9CUqMSH+aPbGsC 3GQe1rMGWoEu5u61u1wpJVE02uA5KyeZmn4rIxvNeCovg7qR+PvCbWa0dHju4X+uByZW 60Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WxubH5IM; 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 19si18169189pfc.239.2019.08.22.08.21.07; Thu, 22 Aug 2019 08:21:08 -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=WxubH5IM; 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 S2389576AbfHVPVH (ORCPT + 28 others); Thu, 22 Aug 2019 11:21:07 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34119 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727874AbfHVPVD (ORCPT ); Thu, 22 Aug 2019 11:21:03 -0400 Received: by mail-wm1-f66.google.com with SMTP id e8so7328793wme.1 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=bCfLzHjDUrg2hZ5GF5vCCI8+MdCFpNUo/XilsQfZPqapuL0GKUg3GFJpXMcpylfcJ0 YYAZj8hlE8kzW+6k8MNQK35inaT/wM2zoQr/degqaiYlrvHGA5cPIAq77nhZP2/o9mYA tp2o97N6A/ZPQfu57o8gVdcz4c3vL5aSWLt06CzW1PBR0NeYTLbzqvCrg4fKAUSEWNG6 9i3EWPjVaSTen9p7HqOSEr4hMIfignYt+8iMlXQEqA/Xhz+OPAAaum1TgN9IItw0GW5o yFLqOGlAYsGPV7FakWYQ/FUIlXFRjylqKX2VWi9rHW2jDYa77DaYHHZQWLE1Xiktys25 CWwg== X-Gm-Message-State: APjAAAWhXwP1WUTG6+cqoqcNfrIwoh0Q2pRIThjI+/QoC3TLUf/bYFC6 iIGiTITZiRr9LP8EAk0075Bi+A== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) -- 2.20.1 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: 172030 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1036618ily; Thu, 22 Aug 2019 08:21:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSoQpIbvBVKItL9Foyg/BJFfLdm9t/DMsnRftFbK7QHQnbBKqi9GZPKeW8Is/oURbikQIe X-Received: by 2002:a17:902:1e3:: with SMTP id b90mr39842352plb.82.1566487270206; Thu, 22 Aug 2019 08:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566487270; cv=none; d=google.com; s=arc-20160816; b=vs8xkGxxV2juwveyqDCSFU3o/5AWcShSwCUzdElnlCaTfMN06886C6Z9hKrfkpTVUU GZe4jBj1qHJUl7p96JZfu9rGOhKm/20Cnveqtxh2snuuSZvtFseh7DVyrqtjEA9WF3GJ gWsKULATPrEw2Kj0kCTRsH73Iegx+zTN28IDGNEqKPi1L/UKhxnVJUbLolOazV4ePw8O iXJxtwegqWHWStnnJ5cjt+qN9mG4Aogqxj6c3u38/vBStDdhailY7W9lubw5eqVM0QZT hdmLeTdO7Rg6K+Y7hlqgl7p8xFtfMJs8J6BbjkSbLr8Fl3otL1S2mK0N0abmhsmAAgF9 uA0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V/3hIve56TY3nPZuccDF0XScvmoR85KKgvEdDQPL/bY=; b=jf0I3O6BOZWE4aMhhfJZ5xos+rzOnCpmgw/7tU0R6Ifj1bH014iUEjFo9GOFtMal5U hVUKJ9M/2oGFkmE5LKxE9oEZQ1MfF2ThDRndOz5Scnvwa0ICcVQYbDfNf7EeHCAJARqc Te+L5AeJe3SJix/qmkg8fu+5EpevnV/tUwcZGRnPVvCaQZtz53YC1XmAaaL/ueJlyF75 jdiRrzxjPBd4tbKKXQTXuGdzVs/NnmmrWxQuLmC/T3Ou+UnGhDUejGKHBX3CVIhJakP8 /Cdd8Tcl+UgBekC9pzqQHWlqQm7re4BRmM22PyAwHpblxgFDW4Y4TfykzKrf2H+he4+X Qk2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x15ajMuF; 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 19si18169189pfc.239.2019.08.22.08.21.09; Thu, 22 Aug 2019 08:21:10 -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=x15ajMuF; 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 S2389566AbfHVPVG (ORCPT + 28 others); Thu, 22 Aug 2019 11:21:06 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38731 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389553AbfHVPVE (ORCPT ); Thu, 22 Aug 2019 11:21:04 -0400 Received: by mail-wm1-f67.google.com with SMTP id m125so6184183wmm.3 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=phjJK1Q4z+UV7qtKytWZkvAuWGPPxXkUg00XsEM7R3eqPt893Nv9bdVn1n5znzwzjx F2R+jQ/em0ecu4toFTfQdE1UgurDCyJTV1Z0kULnpKi+TuL8zzClWvucFcjjRv620oF/ mgp+YdtjBjkIBicEUTCl/7m+lNELiJhQ1A9/zYPLJQL/jAuRNM0FwgzlC0nQNiLZSOTW omLxQrKUrhykBwX1t+Vh0vmUteTj+TvE4wgwu2Kxw7SRpE9W9wWVcFejIJz+jfwhbdxb Pulqqlw4Nlb2iEGC9BB9IZmHdhp/BClydauRyGZOZTXMH+Ex6m50COEujcpqUqvj7A2p rLQA== X-Gm-Message-State: APjAAAXdflWBlcq+kGAxkXjQpkeOoc1FhqLhRrf5WBwH8GHUcpbKQtLW Rbq8DpHm498Sthb/vuhlOojZgg== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) -- 2.20.1 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: 172031 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1036845ily; Thu, 22 Aug 2019 08:21:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKHVJAh7yOWBTZ5XbmfZG2Ao9KdAcZOd7dT7UihvGtzLYlSSkp4QUblskN3S1apwh7oZIS X-Received: by 2002:a17:902:bc49:: with SMTP id t9mr40251781plz.277.1566487280035; Thu, 22 Aug 2019 08:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566487280; cv=none; d=google.com; s=arc-20160816; b=hMoIyNXndq7P9Fyxmt73Uz2W8FzMnwe5VjxRUmH+7fhUDatkUtL9k6Gkb/ua97W+rP VkbENiBn1DE0I3gfx6SRyJV4I+HviuuSQN5trIIzR6Mwz6LMGr8Ej17f2KylDwSqDH88 QpESjYAnRrTGNpTjMYH0V/lO6wLtkFV5U2oX/iEhVivsqOAJ/9ihUu9bVjeqAUkqi++W 3ypr8RJQM+UWjUKDEMWCrHitDPgalHrCWUF7dWV8GBmRrOCIxYk9aiLi6izgON4N4DAN UL0BQMhFq4+1J/le0v3gSjQTMVNkqWX4YcHwbml8SKyftgjqYcXBSVs1q9KPAGNgRORr OB4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dQo/3gCQPUZclinUkVyhVJImer3HlnMgJva1KNL7p2s=; b=eg1sTJ0gw/CCWRmKBm/5RgUEmmab0Swb+wru30a300NV3MtagNzlXH5Hd6V6z3u5Mk VQKeQUYp5FDwcRmysqTnEU7phufvfJfN2j4ytq/lKtbEEMV5c3ryYAH4F935v6PSDE3h djQsuybLBs9iL/c2kDvICsKISs2dxaEoIPAW/gc6WNltiva/kpLkwZqtkEYciL9bRzvW xVc44ROSV8fVU7hkNteWRIL6/vem5q2pCANbq3xtuq7K0LmR4e8pIYSzfIRKa5ieqJ5y mA0lveEPtvyazCZvqa+UwJeDGNI/shj4cZCm1aPQPjZo6uZO+2Q945v1/ueae5pcav0B 10GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CPtPkL7r; 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 g13si17086895pgr.297.2019.08.22.08.21.15; Thu, 22 Aug 2019 08:21:20 -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=CPtPkL7r; 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 S2389586AbfHVPVN (ORCPT + 28 others); Thu, 22 Aug 2019 11:21:13 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:36021 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389554AbfHVPVF (ORCPT ); Thu, 22 Aug 2019 11:21:05 -0400 Received: by mail-wm1-f68.google.com with SMTP id g67so6198545wme.1 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=JjfoUbjL3DHroMtiTx9GNP58ndl+EBP0nH4UqK0MM3ckfVx2A58X/S9xkLtUkeV9lQ xXRoeOdsN05yMnZOGEk8HHUrLwNJ3G+4HrUASiPp8tju8l7IgGQIH0+203C8gEQou997 uvdimeixwugqWdWF9nD4gNvY1xta472pcIBr3jehSfBDB3U/o7WRdJVreNJi3g0JME7u StCOyXgZdFtrfxki30I98QQ1P+p3x3eNFADApmD9cRcCTfwQnpJ0+HVEq3Qa1WWE+Htw XtB7pTHnYmDKsMin0L9hPzqbchJHo/GWgdHb8Ue9goKk1PLXUdZKK2OiHa0Sz4PLZmlJ aUwg== X-Gm-Message-State: APjAAAV4vNaL6iomLlbmU4oYcj9Gu7pwFaMgDVSLMcKXRJ7FYz8cynym rWIx1BUkrO7vFloViBrg6SdzFyh7oEM= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) -- 2.20.1 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