From patchwork Tue Mar 12 08:59:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 160077 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp12861110jad; Tue, 12 Mar 2019 02:00:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgv6Jif5iFvoRMscWkJFBZU0ajE3o/K/LNLByTcU5XQzCF7XdjKeLw5nQcYdOshgsDl32A X-Received: by 2002:aa7:8a0a:: with SMTP id m10mr37257241pfa.129.1552381242179; Tue, 12 Mar 2019 02:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552381242; cv=none; d=google.com; s=arc-20160816; b=c4X/YNGI3C8ixyJ7OjGJKe0iNtyJaAZ/CZz9iOpitqdmnTE1ghr5yDrTdVE2zUG/gW PVrm8yCT1UTEchWmZi6zuVZmN+za9Q0guti1zMI+EE40YYTDQ29tffrtUqA2yd2htymv BiaJj1eLfzH7uFF/1xxA0AxjHQj+cjn3i8E8739vBYkBz64PXPFu0hBpSJVlh8szfnUN VDNIxkjSlcmNaCynWya6rIaxMaS3PpHxuVM6K7M4UOyfp5jhXwvYT0JdmSlv70ETb3ZC S3MvWyGP3p0i/Jr+hqstNC6PwtjvKWHJYl/WLrzl9bfOKFHm09VhspIlZFzGwrFuEtBm HuuQ== 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=3yl3XU7a49GA8s9ZssN4iqwWKfxKo62fpyxLFCHTfdM=; b=gpRE3IirOl0t1rI3ZykUz8fSNhhfVTARlmnx7T8Ms70jVChlqIrDSVAbWgVA0OcUk7 tA0yppQtUbR0jhqKWWbFAB3Ajvdjf+3PL1nZKb5igj2GBa2hDqNtUVbir/1QeEJQPP9d IehZk7+4bJ/vR7kf1ersCBJejp/d1xcd3vJ6K7jgylIo9TjDH95F1vcza2VAO6k1QaVn KTkxYRRP8aDWejfOfTVY8RyNE0dqzxd1nspMOsG6g6BTrgtJmKlM1mAq52iJ72QW/hjg q006aLPQmES17BB/lZkS50SEzyJvx7HKcWuQ2kFk91vjnqtawUU3dxVwhFpWJxgXKxaM VSxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l21Jl1yZ; 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 x6si7137636pge.211.2019.03.12.02.00.41; Tue, 12 Mar 2019 02:00:42 -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=l21Jl1yZ; 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 S1727780AbfCLJAk (ORCPT + 31 others); Tue, 12 Mar 2019 05:00:40 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38520 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727690AbfCLJAK (ORCPT ); Tue, 12 Mar 2019 05:00:10 -0400 Received: by mail-wm1-f65.google.com with SMTP id a188so1678909wmf.3 for ; Tue, 12 Mar 2019 02:00:09 -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=3yl3XU7a49GA8s9ZssN4iqwWKfxKo62fpyxLFCHTfdM=; b=l21Jl1yZjVVBrUCvymJJxze0ysYHTiw8TwtK9e3AcziIbTngV9WXO4AnA9uaSTgijV D9MiZAR73lQWdDxKHhfzUeEpliUC5D0O9sZw0nt2rKKp8HrBo8chqhzCVM9OsrR/kIlL P0pyx7lS+4XtIDzMH0kO89P5l+IhAEwDth3GMsu2NSFiVT8BxqLESpvxWTN5Q0iPqB/W ImhpUq7ArZI6iObjZu8dHr/cRWWH4zFWQkkJxcYC5RrkB53h8LJ16qt/3BnkWHZlz59o +TmHndTPD2q4e/yulwkvL/dGT7lE7gfxkW0XWYl0rGKQu4IjNcr6yfThWciXGbglUCA8 QJ4w== 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=3yl3XU7a49GA8s9ZssN4iqwWKfxKo62fpyxLFCHTfdM=; b=sanrvFUvkR5B69m0YObOjgTV9FrTnzz8ukXMYSUncgCnS1f2CnyyjUGsETrWLxVdRt On/EV7z8gw2l5bt4mJYcuUR6rFDby1Lak8IfgEDZyXdkzppdosIUMpTFIOCvT73ZveP8 0UGrVIgjkdpnAMB7OHELJuUxgyvg+Zelce60aZ9LvWiVzX+5moIh7KMSKeH1EG3fce2L pvTWyIj/K/ydcYLqZsMscia78l50H2G9mCg7t9ATbHsSxGKaeHbwqHLGDzau/sYHmFpb TVyv+wrzDItt3pVgE0NjRgSOD2aMMf4O0miyjRaoBOeInPO/gB8FW9PanFBhg/1BTXzj SYpQ== X-Gm-Message-State: APjAAAVBk/QXwrxL3f/Xx2aUr2TLljTyq570rDO9JfpgcEJw4z42gjnK oF/HvG0UkLX9AxcaoCm+FAWw4g1zLVo= X-Received: by 2002:a1c:9694:: with SMTP id y142mr1501451wmd.98.1552381209127; Tue, 12 Mar 2019 02:00:09 -0700 (PDT) Received: from localhost.localdomain ([84.33.65.66]) by smtp.gmail.com with ESMTPSA id y20sm3953043wmi.34.2019.03.12.02.00.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 02:00:08 -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, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, fra.fra.800@gmail.com, alessio.masola@gmail.com, holger@applied-asynchrony.com, Paolo Valente Subject: [PATCH BUGFIX IMPROVEMENT V3 5/9] block, bfq: do not tag totally seeky queues as soft rt Date: Tue, 12 Mar 2019 09:59:31 +0100 Message-Id: <20190312085935.11340-6-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190312085935.11340-1-paolo.valente@linaro.org> References: <20190312085935.11340-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 Sync random I/O is likely to be confused with soft real-time I/O, because it is characterized by limited throughput and apparently isochronous arrival pattern. To avoid false positives, this commits prevents bfq_queues containing only random (seeky) I/O from being tagged as soft real-time. Tested-by: Holger Hoffstätte Tested-by: Oleksandr Natalenko Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.20.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index b96be3764b8a..d34b80e5c47d 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -242,6 +242,14 @@ static struct kmem_cache *bfq_pool; blk_rq_sectors(rq) < BFQQ_SECT_THR_NONROT)) #define BFQQ_CLOSE_THR (sector_t)(8 * 1024) #define BFQQ_SEEKY(bfqq) (hweight32(bfqq->seek_history) > 19) +/* + * Sync random I/O is likely to be confused with soft real-time I/O, + * because it is characterized by limited throughput and apparently + * isochronous arrival pattern. To avoid false positives, queues + * containing only random (seeky) I/O are prevented from being tagged + * as soft real-time. + */ +#define BFQQ_TOTALLY_SEEKY(bfqq) (bfqq->seek_history & -1) /* Min number of samples required to perform peak-rate update */ #define BFQ_RATE_MIN_SAMPLES 32 @@ -1622,6 +1630,7 @@ static void bfq_bfqq_handle_idle_busy_switch(struct bfq_data *bfqd, */ in_burst = bfq_bfqq_in_large_burst(bfqq); soft_rt = bfqd->bfq_wr_max_softrt_rate > 0 && + !BFQQ_TOTALLY_SEEKY(bfqq) && !in_burst && time_is_before_jiffies(bfqq->soft_rt_next_start) && bfqq->dispatched == 0; @@ -4816,6 +4825,11 @@ bfq_update_io_seektime(struct bfq_data *bfqd, struct bfq_queue *bfqq, { bfqq->seek_history <<= 1; bfqq->seek_history |= BFQ_RQ_SEEKY(bfqd, bfqq->last_request_pos, rq); + + if (bfqq->wr_coeff > 1 && + bfqq->wr_cur_max_time == bfqd->bfq_wr_rt_max_time && + BFQQ_TOTALLY_SEEKY(bfqq)) + bfq_bfqq_end_wr(bfqq); } static void bfq_update_has_short_ttime(struct bfq_data *bfqd,