From patchwork Tue Mar 12 08:59:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 160071 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp12860581jad; Tue, 12 Mar 2019 02:00:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIBcRGB8amN+CHT/X21mhrUJJSvr6cGdk60AwfMTUhizIwb2jatf+qlOCPdo8Qz39qBi2/ X-Received: by 2002:a17:902:7c8f:: with SMTP id y15mr37993912pll.44.1552381210056; Tue, 12 Mar 2019 02:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552381210; cv=none; d=google.com; s=arc-20160816; b=LTIEWJQ+EuNXeEY+9t1KE1G2Qoc9c5tjwq71tTbADeToOpr5iA+RPaPeEHjlN9BZlS Tpf/q1gl/JXhdK3H3fYGGOn0xO8HsBuZP1csmufnO6T3XL7K1uX2nXmMarGcpP40sQWa D+IXOscXl2DDEgQU8eTSFy9vyIkRDLMKbzspc2hG6720rIBwnGcfC01t8Q/JiYPkhEZs 73DDw/oJe+RncUQYMxzUcgMopjAWmjejjmUqnFjhBuNGxLrNOs9zva30paNFcRcBLxMf P3KAGW7u2OTS+S65mw0UEgVKzHp1cDAc5RGO8vgHgyZztwsJRDF7I+cKe5947LU5466k Pxwg== 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=zPxdu4FfztX2fjTuYHQF2xv6a9EM4Wt9HqApVzFZrNQ=; b=vPh5pU70OJjzlpP7Iqe56lufJ8O4Ou7A5R+tTBo3JLtyGB/RqprM/cxevNgNcenXXS ai4KYt5V/5BNrlfaZ/4TsY1Mp+iy4vw1hFI8tJ7fmHt38o6TiYoCKZc286h9+oD0HqZU fF3OJqxFyMWGN9pxf2imhOJvVJHWORMpLDRwxkaDcuHnp9l4l8rmu7SR/tJbkFdDX5Ji UKjVY+hWSaQ0tf0rydDJ+Kfe8+9n8TJ3y3HgVasGVR91+BFMFEicj9scTQ78Q9KVBjPL eAkCAUBSUQ5mCwIENCn5tYHRuvYy3Od7IVZ/iZzGvDwq5DMEnQYfksi88Yj4OkJHoiP5 CqMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nxSGFbhg; 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 d16si7538316pll.236.2019.03.12.02.00.09; Tue, 12 Mar 2019 02:00: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=nxSGFbhg; 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 S1727685AbfCLJAI (ORCPT + 31 others); Tue, 12 Mar 2019 05:00:08 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44495 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726924AbfCLJAE (ORCPT ); Tue, 12 Mar 2019 05:00:04 -0400 Received: by mail-wr1-f65.google.com with SMTP id w2so1716513wrt.11 for ; Tue, 12 Mar 2019 02:00: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=zPxdu4FfztX2fjTuYHQF2xv6a9EM4Wt9HqApVzFZrNQ=; b=nxSGFbhgUV0GSjJ9o0aDkRUnhb7rF4cJZtG3yJI9SPaZe2touaWmq6dTzIQY4cRU5+ M7c7dYRu+uAfqfNYcdYt9snPLYlW8d7Y9FDxZNoAUq193PlzQyJBqYdKkoGkR5xLeWpd wwyU9CrT9T4ZqluwiVHQGN0Susi9hncsYO3TS9lR+fv5qvLyDtapVYBQ7ItRP1j86pWY /5gbuYUSKD+RkoG1EduH4lBiCwb6lpIsAHe7mPJvj4d/j+EwwlMuhlqIAVILdaq2TN/I j/1IhcQT57Tj4Zu5ODQPBcj2ndBq6dU7vAsvwfG1LpPKyhnqsdJV0MlQSVzMs2GWttMC SxCg== 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=zPxdu4FfztX2fjTuYHQF2xv6a9EM4Wt9HqApVzFZrNQ=; b=Z1YI1+rSA/4YUmA8RWFqVWEbR/1m12IdHBqMwEvXM+3Zg5ZayNLSRLimU0b/GkNDrJ +Z5EuFOsWyj5TVRmKf/FyMhHUqB8Y1WJ75juNtapSid79pIs6omsx3LACftaGPjZQGGq qvcEpYt9332E0Vs3EfFetw/MlNcfXljwxXS7V8oNZD2sKuh2PZ8aNyQv9x/+q0xNnaYW hqghzo1YSerigej734bfMJtXZG7gSmDR6sGiigysq6AIHZqxAj552/fYAPz9i2aOY8hd dR3XBpFbfMe9ZqtSt1/yeQl5kyPTiNEx1hP4JkAQZgVP0ajeriFI9s8ji8NcCLOAl3qP vGoQ== X-Gm-Message-State: APjAAAVxCOIDNgbZeRo/zwMsr4e84t/i7oqmV62vG26rxrCZFlgbBZdr gSX0eJusxjgLlkFEA8cyzxx7jw== X-Received: by 2002:adf:fe05:: with SMTP id n5mr10000720wrr.160.1552381203408; Tue, 12 Mar 2019 02:00:03 -0700 (PDT) Received: from localhost.localdomain ([84.33.65.66]) by smtp.gmail.com with ESMTPSA id y20sm3953043wmi.34.2019.03.12.02.00.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 02:00: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, 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 1/9] block, bfq: increase idling for weight-raised queues Date: Tue, 12 Mar 2019 09:59:27 +0100 Message-Id: <20190312085935.11340-2-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 If a sync bfq_queue has a higher weight than some other queue, and remains temporarily empty while in service, then, to preserve the bandwidth share of the queue, it is necessary to plug I/O dispatching until a new request arrives for the queue. In addition, a timeout needs to be set, to avoid waiting for ever if the process associated with the queue has actually finished its I/O. Even with the above timeout, the device is however not fed with new I/O for a while, if the process has finished its I/O. If this happens often, then throughput drops and latencies grow. For this reason, the timeout is kept rather low: 8 ms is the current default. Unfortunately, such a low value may cause, on the opposite end, a violation of bandwidth guarantees for a process that happens to issue new I/O too late. The higher the system load, the higher the probability that this happens to some process. This is a problem in scenarios where service guarantees matter more than throughput. One important case are weight-raised queues, which need to be granted a very high fraction of the bandwidth. To address this issue, this commit lower-bounds the plugging timeout for weight-raised queues to 20 ms. This simple change provides relevant benefits. For example, on a PLEXTOR PX-256M5S, with which gnome-terminal starts in 0.6 seconds if there is no other I/O in progress, the same applications starts in - 0.8 seconds, instead of 1.2 seconds, if ten files are being read sequentially in parallel - 1 second, instead of 2 seconds, if, in parallel, five files are being read sequentially, and five more files are being written sequentially Tested-by: Holger Hoffstätte Tested-by: Oleksandr Natalenko Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 4c592496a16a..eb658de3cc40 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -2545,6 +2545,8 @@ static void bfq_arm_slice_timer(struct bfq_data *bfqd) if (BFQQ_SEEKY(bfqq) && bfqq->wr_coeff == 1 && bfq_symmetric_scenario(bfqd)) sl = min_t(u64, sl, BFQ_MIN_TT); + else if (bfqq->wr_coeff > 1) + sl = max_t(u32, sl, 20ULL * NSEC_PER_MSEC); bfqd->last_idling_start = ktime_get(); hrtimer_start(&bfqd->idle_slice_timer, ns_to_ktime(sl),