From patchwork Tue Oct 2 12:43:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 147975 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5104659lji; Tue, 2 Oct 2018 05:43:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV62pgKaVBHcEIiBqW/90BXF/SxyS+OBKI0uHRnxXmPqqCddOXwZa7/fBYtOw/xp6Udm6uX8d X-Received: by 2002:a63:ac56:: with SMTP id z22-v6mr14358599pgn.444.1538484218928; Tue, 02 Oct 2018 05:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538484218; cv=none; d=google.com; s=arc-20160816; b=SQBjNUBW0N0vT6prJ2/n57MY0kMskfURaselAOwLwepLOiB7nkXPmFV65RwxUKPeR0 wKVmf1gJ1XtXzS2aWY0A8EcHVqE+Gw9xPxiXZR8WM2VCzo28X8qn5//2F2N+dMjFXa3s 3Sw1lbWH1GwJjz1GvpEa5zgNuoqFMNEzYw2RT7G4T3jIb2rJp6B6ebBFmaneIYkEnsiT 7ppRFP/oVOGCCQIu6K/P7OtlgxMcOgcaKOYxnDMO8z6ewzCsfHfhzKvs+l9Cpj4Akl1Z /OLKCBHhf+vDG9n2k9swIeew7+1fDWLe01vMxyfIM9Mpcz52QsapL1wBriE1PNDurVi4 tGnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=QrEwn+yipGeBRZY5/gGy9a5nu5aovyyAaOxjUkJnx4g=; b=GLPUiOPwogo4o8epCkRngRsZqJu4MDjnDFau1onJ6CP/7QmHx4LpiPmjgGahNO/vd8 QdDHfGG2v0mNKdnvBXB3PdiUYqhAmLbBp3XVEh2qCEeeWmcihR0O6FPt4N3SM32OsFYm FfUAFonGbSgGNEy4Mp9J6S1hgQ+VH1bQotFclMHGQMSFcyiV4Y3b5GxpW0UVrBX8GW0g tBTvE1CS1UxccHeeBBSWeUyoSKe2Te2HIR/PG7mhkM1bm51feP7pH2lrck6mH5jV6lC/ Bno63OGtYWtOhqMYYVxdupgcLhhD1iVi2mDFsaevSgBL/5HpFkoiWC4Sz2mPxgZgYkxZ 4lwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IKOG+/IT"; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 1-v6si16007882plj.15.2018.10.02.05.43.38; Tue, 02 Oct 2018 05:43:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-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="IKOG+/IT"; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 S1727735AbeJBT0r (ORCPT + 5 others); Tue, 2 Oct 2018 15:26:47 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:38302 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727582AbeJBT0r (ORCPT ); Tue, 2 Oct 2018 15:26:47 -0400 Received: by mail-lf1-f66.google.com with SMTP id g89-v6so1301132lfl.5 for ; Tue, 02 Oct 2018 05:43:36 -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; bh=QrEwn+yipGeBRZY5/gGy9a5nu5aovyyAaOxjUkJnx4g=; b=IKOG+/ITKBRtfIypyc3szRhTPjIwYJMJUoJn+rh0yVoTg+xtH6kJUQ85fY+lBnaJrW PxgjM2+FMKI7E3kbyFeAFcNlpZwQJCtAd2YIxcPCwkRrk3ysXafrQGIX6smxYIKqMiMJ 1uaIuRM5nSjBx6yeGyqOO47oxxXDMoIuSWZSM= 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; bh=QrEwn+yipGeBRZY5/gGy9a5nu5aovyyAaOxjUkJnx4g=; b=FGxz58IitVSWOvM1jFL/V22ztxIyxDvj4YmC4XsMmLSMcE4CvOqVKPKsG8Pup8sXbn UTDZpkzUhyiAxxSMdSvxZmTuvl8qTEq2Wt5PE0vKjjBRW/8mXOPhef4Sjzuuy+9i267b xuSGo0ZZXs1gMpPFIwP4twEEOCGndnGt70+tEOFJQCDjPfT1GJszV6kdNo/LfeJiqlZI FrK2F3ICImJibJOS93CzSScvbj8018Fp77LTfQCLx/003nkBGeK7AbYc2xbLDHMuir5V 43/BLRe0MOnxdbuRAGCqmNIu9gvvhyKC0/3ISf5lERbuY+5iDYKsJLbLCIyh8X+df+A8 p0VA== X-Gm-Message-State: ABuFfohravBo6LXynZO/+INLdqO8D7/CDDKpAaebbM3RF/BkMP1nZpD9 a9vMbmxKs2mzCsWAZIyzEhG7Aw== X-Received: by 2002:a19:12a5:: with SMTP id 37-v6mr8713060lfs.51.1538484215889; Tue, 02 Oct 2018 05:43:35 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id u2-v6sm3418171ljg.55.2018.10.02.05.43.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Oct 2018 05:43:34 -0700 (PDT) From: Linus Walleij To: linux-block@vger.kernel.org, Jens Axboe Cc: linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, Linus Walleij , Pavel Machek , Paolo Valente , Ulf Hansson , Richard Weinberger , Artem Bityutskiy , Adrian Hunter Subject: [PATCH] block: BFQ default for single queue devices Date: Tue, 2 Oct 2018 14:43:29 +0200 Message-Id: <20181002124329.21248-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org This sets BFQ as the default scheduler for single queue block devices (nr_hw_queues == 1) if it is available. This affects notably MMC/SD-cards but notably also UBI and the loopback device. I have been running it for a while without any negative effects on my pet systems and I want some wider testing so let's throw it out there and see what people say. Admittedly my use cases are limited. I talked to Pavel a bit back and it turns out he has a usecase for BFQ as well and I bet he also would like it as default scheduler for that system (Pavel tell us more, I don't remember what it was!) Intuitively I could understand that maybe we want to leave the loop device (possibly others? nbd? rbd?) as "none", as it is probably relying on a scheduler on the device below it, so I'm open to passing in a scheduler hint from the respective subsystem in say struct blk_mq_tag_set. However that makes for a bit of syntactic dissonance with the struct member ".nr_hw_queues" (I wonder how the loop device can have 1 "hardware queue"?) so maybe we should in that case also rename that struct member to ".nr_queues" fair and square before we start making adjustments for treating queues differently whether they are in hardware or actually not. Cc: Pavel Machek Cc: Paolo Valente Cc: Jens Axboe Cc: Ulf Hansson Cc: Richard Weinberger Cc: Artem Bityutskiy Cc: Adrian Hunter Signed-off-by: Linus Walleij --- block/elevator.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/block/elevator.c b/block/elevator.c index e18ac68626e3..e5a2c39eee7b 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -948,13 +948,15 @@ int elevator_switch_mq(struct request_queue *q, } /* - * For blk-mq devices, we default to using mq-deadline, if available, for single - * queue devices. If deadline isn't available OR we have multiple queues, - * default to "none". + * For blk-mq devices, we default to using: + * - "none" for multiqueue devices (nr_hw_queues != 1) + * - "bfq", if available, for single queue devices + * - "mq-deadline" if "bfq" is not available for single queue devices + * - "none" for single queue devices as well as last resort */ int elevator_init_mq(struct request_queue *q) { - struct elevator_type *e; + struct elevator_type *e = NULL; int err = 0; if (q->nr_hw_queues != 1) @@ -968,9 +970,14 @@ int elevator_init_mq(struct request_queue *q) if (unlikely(q->elevator)) goto out_unlock; - e = elevator_get(q, "mq-deadline", false); - if (!e) - goto out_unlock; + if (IS_ENABLED(CONFIG_IOSCHED_BFQ)) + e = elevator_get(q, "bfq", false); + + if (!e) { + e = elevator_get(q, "mq-deadline", false); + if (!e) + goto out_unlock; + } err = blk_mq_init_sched(q, e); if (err)