Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1737339imm; Sat, 6 Oct 2018 09:21:00 -0700 (PDT) X-Google-Smtp-Source: ACcGV60zM/Esv/pWAJLFNjBNACrifoWw7Z5k285nmgN2K7SwT3c+IC0D1Kd73FF8Vu0ziW5u+Fd4 X-Received: by 2002:a63:3dcb:: with SMTP id k194-v6mr14622831pga.191.1538842860430; Sat, 06 Oct 2018 09:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538842860; cv=none; d=google.com; s=arc-20160816; b=t1IpNTQEpZwyvDPyWX4JtlVYCoNx2zIRs+4Ru7XaBuCIARit+BpLQh8HDC089mvFMS Yxq6FWy1Opha0DV+2ECsyrT1RinlWpp+kV0gVAlWWCsBw1JDLJG2zMwjMUVkbCYogdom iFaYsNi68KhmKDy4OBPtxjsoENsuFWDnm2HrCLoc4Whgrvnyl6IWVZRaQWA/YhWTNpgK 0n0cIDQvH7YUcdGmdx9V09t9Sh2vEWBKg/aXUoMCFmKiNCMKlg97Mp0mMxvwhw2cAav7 Q3dH4MCnxmvbsuurMe9VaSGtH3BReyi+5DK9e6ELDjAhSh5ulTxnMkCEHX0WBC5/06oc ICIA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=JBqo3Tigp6DrtN5FjWh5ypYxgjKNLr6+l7/PhoYCzh8=; b=hpTWBCMlNJl3frGNizoweS5dnHRJDAF4GHjs6N70BtZ4U6VdGajU4BN52KqCNtxXQ5 yKPt6OHnZvGeJYDGHFjvjdeFYykQdh3AVWs6TeJkyHsqparV13q3GiFXbHdq/+3QDVt3 TD1in8NRf/RdJnFTgQFx5gItSPrz9LdppK4+0UArj2lWLyly3JLRGBGF5h5P0moaBk93 6HRZ/cvfBCkIHJh7gRaPXYaDPZ1pxGyUu+SlpaAF2X1TIanmV0jpfFwcqEswnh7WKRl8 6zVsPwl1K3wVyv3iuYYxqhn+N53JKzzjNrur2m7HejhqSMkz+GujQPFX+MtV1lUeMC31 GUOw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e127-v6si12723420pfe.8.2018.10.06.09.20.44; Sat, 06 Oct 2018 09:21:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727674AbeJFXYh (ORCPT + 99 others); Sat, 6 Oct 2018 19:24:37 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34622 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725266AbeJFXYh (ORCPT ); Sat, 6 Oct 2018 19:24:37 -0400 Received: by mail-pf1-f196.google.com with SMTP id k19-v6so6476108pfi.1; Sat, 06 Oct 2018 09:20:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JBqo3Tigp6DrtN5FjWh5ypYxgjKNLr6+l7/PhoYCzh8=; b=hdsEzOmwFG5Xj3EXuQdTL9KYDZ2TB+zQpSHvvKvJbVqGVKDWaYoKaNNmYlC16WTIiM eDSAmuWVhYdmcLfubflDLnVhXHp0ZQVuH5T9DHzhuXCD5cAARjKbkpUvo2Pbed0AVriT 5tLBvJD9VLQMZjyT5ZvWLmmDVcZPaZXqS9z/ITM9yoaz25pjYQBKVQm4+t1P0T1bTrM0 uPMga5TxyMe5AIV8jAy2NZTerM9eboAU0zcNSwBIhOIY2zlyvzpgKNqu4WkA/P9XPix/ 0YFVsJSkvP1VD8gYDWZ4rlNwhSpycWeDEbRdJoKHHP6taQLMuxubuopt1cX0R7SL8Ia1 McYw== X-Gm-Message-State: ABuFfoiHRJoBXwd9MN+rEqugiK33MMcbu/Feqqod+6LhkFy3dMcoaYTE VbhQDPRUVZEp9TQg3mJwyBIqxlQBHHXSww== X-Received: by 2002:a62:210:: with SMTP id 16-v6mr17838256pfc.100.1538842839318; Sat, 06 Oct 2018 09:20:39 -0700 (PDT) Received: from asus.site ([2601:647:4601:42b4:3842:3e31:3bb6:cf62]) by smtp.gmail.com with ESMTPSA id y24-v6sm1391463pfn.123.2018.10.06.09.20.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Oct 2018 09:20:38 -0700 (PDT) Subject: Re: [PATCH] block: BFQ default for single queue devices To: Paolo Valente Cc: Jan Kara , Alan Cox , Jens Axboe , Linus Walleij , linux-block , linux-mmc , linux-mtd@lists.infradead.org, Pavel Machek , Ulf Hansson , Richard Weinberger , Artem Bityutskiy , Adrian Hunter , Andreas Herrmann , Mel Gorman , Chunyan Zhang , linux-kernel References: <20181002124329.21248-1-linus.walleij@linaro.org> <05fdbe23-ec01-895f-e67e-abff85c1ece2@kernel.dk> <1538582091.205649.20.camel@acm.org> <20181004202553.71c2599c@alans-desktop> <1538683746.230807.9.camel@acm.org> <1538692972.8223.7.camel@acm.org> <20181005091626.GA9686@quack2.suse.cz> <20bfa679-3131-e0af-f69d-2fbec32fbced@acm.org> From: Bart Van Assche Message-ID: Date: Sat, 6 Oct 2018 09:20:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/5/18 11:46 PM, Paolo Valente wrote: >> Il giorno 06 ott 2018, alle ore 05:12, Bart Van Assche ha scritto: >> On 10/5/18 2:16 AM, Jan Kara wrote: >>> On Thu 04-10-18 15:42:52, Bart Van Assche wrote: >>>> What I think is missing is measurement results for BFQ on a system with >>>> multiple CPU sockets and against a fast storage medium. Eliminating >>>> the host lock from the SCSI core yielded a significant performance >>>> improvement for such storage devices. Since the BFQ scheduler locks and >>>> unlocks bfqd->lock for every dispatch operation it is very likely that BFQ >>>> will slow down I/O for fast storage devices, even if their driver only >>>> creates a single hardware queue. >>> Well, I'm not sure why that is missing. I don't think anyone proposed to >>> default to BFQ for such setup? Neither was anyone claiming that BFQ is >>> better in such situation... The proposal has been: Default to BFQ for slow >>> storage, leave it to deadline-mq otherwise. >> >> How do you define slow storage? The proposal at the start of this thread >> was to make BFQ the default for all block devices that create a single >> hardware queue. That includes all SATA storage since scsi-mq only creates >> a single hardware queue when using the SATA protocol. The proposal to make >> BFQ the default for systems with a single hard disk probably makes sense >> but I am not sure that making BFQ the default for systems equipped with >> one or more (SATA) SSDs is also a good idea. Especially for multi-socket >> systems since BFQ reintroduces a queue-wide lock. > > No, BFQ has no queue-wide lock. The very first change made to BFQ for > porting it to blk-mq was to remove the queue lock. Guided by Jens, I > replaced that lock with the exact, same scheduler lock used in > mq-deadline. It's easy to see that both mq-deadline and BFQ define a queue-wide lock. For mq-deadline its deadline_data.lock. For BFQ it's bfq_data.lock. That last lock serializes all bfq_dispatch_request() calls and hence reduces concurrency while processing I/O requests. From bfq_dispatch_request(): static struct request *bfq_dispatch_request(struct blk_mq_hw_ctx *hctx) { struct bfq_data *bfqd = hctx->queue->elevator->elevator_data; [ ... ] spin_lock_irq(&bfqd->lock); [ ... ] } I think the above makes it very clear that bfqd->lock is queue-wide. It is easy to understand why both I/O schedulers need a queue-wide lock: the only way to avoid race conditions when considering all pending I/O requests for scheduling decisions is to use a lock that covers all pending requests and hence that is queue-wide. Bart.