Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp322739ybh; Wed, 11 Mar 2020 01:43:14 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuPo+8cKAm1aAF8si0hb1L6TPd2yop+DH4JZJq3kRDlTldYTeq62fe8/iXG5uHEcLco8/d+ X-Received: by 2002:a05:6830:1498:: with SMTP id s24mr506918otq.242.1583916194133; Wed, 11 Mar 2020 01:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583916194; cv=none; d=google.com; s=arc-20160816; b=FXH4U/LSFgbkxP064StRN6PdG2YzpKvY/wIRMeBhYQ8YxT/AAdYgvKcs4CPVj/J25t a9YReeJ7/qJDugVhZSN2nNuzefJXagk81xNjT0YjGGC8KACM+G5JwRYPpeb3g3dPS2nZ V8J8UOp8xMvIT39WnzNSuaqzQNb90BBTZ/rPsLSWHTMvkzgCJgqGH+ZmviCRNqUcG711 iIoxbZbk/KmSfu0x0yRdUZpZGbZrRfFMTMOuc+faRJB6uXbAf4HBttM1B5rUIFtnClwV XtL+sDbv4aJyeeRLC0uf+0qTZDmxiM8UtL7a8Iuij8C6beLqbMH8vtEXer5HTkAerseU ckhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HSW/+5dQsu/FqLoyL9jf+9ZZDs2OGV9dnsgXg37rKKk=; b=EeQ1QCjSvHhlzIgWY4ck/G4nQpou9DWKg8oJ6MWdqpUtvNYgMkGOpzYS/zp/vuOwpi i0LdOmkmJHXre3SRx+rWcOz+Y9fJbvjB3YpTUTTwhRxkoeVSPtDxf0a4x+ZaiAPmFYpT bxnqjp/qPGJPl4ydBoCS3bV39/U5D08gRCU36t/UYqz+J6hL4S27Th2V+5omsj+OO+1u hVlv9lUtvNAj6dsoBv15jcxHtgoElmRzynkpG2Tgl608LPhA6vKgwsZF1iGtrVjonELL cbyqxv+AULTQGKXJ0WxFD6yZzWjFF124C8mLZ54cTqPvrlc8Fi8BO0AcHCHShRQTTqaw 608w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=DgLSRBQU; 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=REJECT sp=REJECT dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 48si820033otv.320.2020.03.11.01.43.02; Wed, 11 Mar 2020 01:43:14 -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=@android.com header.s=20161025 header.b=DgLSRBQU; 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=REJECT sp=REJECT dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728585AbgCKImc (ORCPT + 99 others); Wed, 11 Mar 2020 04:42:32 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:38918 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728195AbgCKImc (ORCPT ); Wed, 11 Mar 2020 04:42:32 -0400 Received: by mail-lf1-f67.google.com with SMTP id j15so960583lfk.6 for ; Wed, 11 Mar 2020 01:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HSW/+5dQsu/FqLoyL9jf+9ZZDs2OGV9dnsgXg37rKKk=; b=DgLSRBQUrCDt/5nBAjCAkkyg2P+43TXZODJ95anLVv5NU++tsUo06UW3OkHWu83+g7 nmhMf5fweE4BGTYxQQN5I6UMHRoF3TzoUrSn84LoRkhTb4Btrv2WLiS7syKdnM0QTZ2c viVJFORB/ckRZHyDyVluU4L012uH/Rom6oOXPav6af6abuCO1txfmQ7GRaZj2NdNQp0z U0JOoaiwk00j2KSoA5lfW0+r+fD9gxySNRDFWyeQXTDXMlhTOOnosBeCv66xHzkKHtEB jjelGy4N+XdYZsRS8YPjhzPHRECZ0SmbpwqslniF4eI+M4oozeEKpSID1jjSGusoVX0T rE+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HSW/+5dQsu/FqLoyL9jf+9ZZDs2OGV9dnsgXg37rKKk=; b=RlzLzimUgIm1bTp1gdePZY3tCpmJhS+94RAp9hgM3xrg5J9eb0GaoVHvIqEd/mhfuq AJDZ41a5HTjt52RISQTXkxOIUB6zSPALIosIL6wb75BTR9IRJyWUTHZP1kkAYUPnSkrx CrECE0aq1OPKH0qvVzWMjgzfihmUa7nTA7KJxdoytCwcHkYk9xpa9PHu/kKbjnqXJTXc N/CWf1E6d1n+CRgubDt4LXXnflMVKu0gynPxJq+g8d+u9B+pXeKonJPqJp17lEuosPO2 kBZvG5NPSnVcmPW2wiRWU5OvpKZsIJKvMTXnNyIqpNIBFiiGK6nNB1AYT86OA7lL5GYV UV5Q== X-Gm-Message-State: ANhLgQ2bqU7peOepLsUD6pwLGICi9bv1MMFS1pD18xyHiE7SFseSt8kP WT0sLS9mF2bpnIzEj3i7KZ3xi+1+DLdFQjbkw4DlPQ== X-Received: by 2002:a19:cbc3:: with SMTP id b186mr1524321lfg.182.1583916149757; Wed, 11 Mar 2020 01:42:29 -0700 (PDT) MIME-Version: 1.0 References: <20200310131230.106427-1-maco@android.com> In-Reply-To: From: Martijn Coenen Date: Wed, 11 Mar 2020 09:42:18 +0100 Message-ID: Subject: Re: [PATCH] loop: Only change blocksize when needed. To: Chaitanya Kulkarni Cc: "axboe@kernel.dk" , "hch@lst.de" , "bvanassche@acm.org" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kernel-team@android.com" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chaitanya, On Tue, Mar 10, 2020 at 9:23 PM Chaitanya Kulkarni wrote: > > Logically this is a right thing to do, but I wonder how much speedup > you are getting with these improvements ? > It will be great if you have some numbers so we all know the speedup. What makes blk_mq_freeze_queue() relatively expensive is that the implementation of that function calls synchronize_rcu() (for good reasons); on our x86 devices, I've seen that take 15-20ms on average. Recent Android versions configure a lot (~30) of loop devices at boot, and so this saves us about 600ms of boot time. I strongly suspect this benefits other usecases besides Android. There is another call in loop_set_status() which is harder to remove; eg, if you use loop_set_status() to change the offset of a loop device, you shouldn't do that if there are still requests outstanding, and blk_mq_freeze_queue() ensures that. But in our specific case, we know that there won't be requests outstanding, because during this phase of boot the loop device hasn't been mounted yet. But we can't tell the kernel that. So I will follow up with a patch that tries to address that issue, which will also have some more detailed numbers. If you have ideas or suggestions, feel free to let me know! Thanks, Martijn > > Irrespective of that, this looks good to me. > > Reviewed-by: Chaitanya Kulkarni > > On 03/10/2020 06:17 AM, Martijn Coenen wrote: > > Return early in loop_set_block_size() if the requested block size is > > identical to the one we already have; this avoids expensive calls to > > freeze the block queue. > > > > Signed-off-by: Martijn Coenen >