Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4059188pxv; Mon, 26 Jul 2021 20:08:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6NVYvDkf+nbXpdpsWqrRUFOTxikvh+730iZWgaSNcIhcofEuIuc/5DdFLvgqzvsWSo6+s X-Received: by 2002:a92:d5cf:: with SMTP id d15mr15156637ilq.194.1627355281898; Mon, 26 Jul 2021 20:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627355281; cv=none; d=google.com; s=arc-20160816; b=XcMhcjTLcePHlsb44hglMgDxV11HjGzI2VZw7d5vOMn/188zYD6PosADy4MyLupKsS gwWYKReWFH2dSXA5/wzawMmEIZlrs+CQiOsczYm2hrAp2/cj427wqnxV7FG2ZbdQtyR9 y5VLXab/Ufy2DmAirS9/1kwvN7OcZvtd4aHlHczq5spqNZqfhevq8gUrkOpxunK5QJHb 3/N3NAieMvCk2pD6ZHVl5VAIOCDrG+mRk5tAhVwn8ObDZZDIVtuiyFIB0lU/A/vBIQ0b lu01QB9gf2r7abMkLFAstYI/iLTn3BDAZCiC3qVTsLFhcTjdb2uYbcgf26psJ/+AxWVy wY6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ChIcbIgLJX/+eQRpKvWif40abxApwvOjyIFA0z+RMsM=; b=Mb2oimWBvE0jgp2yH0XMqdJBPZrOFvUHtfAaVCT00EcCpIhrv2V9wHqNNqnVW5B2pR XbhrNVq7yDtZ+sZWliKOHzu+f9QDgonI9bVGui6CO7kRNkYj6Tidh/AjBK/5mfZ8+7EQ IaS39ui4VJbHvCSJolI29dKdC2BEfx7wjmgS1a9UcDFwp+uAJnPQpifSh56AKw812pCX Y/7QleM8Vs0rNOS1qwcCtgcT6II1K/IY09BYFjPCqS3lG+l0VKGHSFZEQW+4Wj3eoNTR cBNDSXinTWY/gn/JM03IAwgy3uyyFbvNtcdL/xn3LQobcQR9PRNbaK1UcDOC9VNGuDVK CQVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MU3drwGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y12si1834853ilq.107.2021.07.26.20.07.50; Mon, 26 Jul 2021 20:08:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MU3drwGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234793AbhG0CZ7 (ORCPT + 99 others); Mon, 26 Jul 2021 22:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234677AbhG0CZ6 (ORCPT ); Mon, 26 Jul 2021 22:25:58 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68AA9C061757; Mon, 26 Jul 2021 20:06:25 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id b6so15769049pji.4; Mon, 26 Jul 2021 20:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ChIcbIgLJX/+eQRpKvWif40abxApwvOjyIFA0z+RMsM=; b=MU3drwGpgkx0vfwBNTNFP3MytUOGuJQ3j50dvYOId0AswZfumYMStyl+z6WjZn8xss wI9eMWl1JEQ+vqomHrTtUT/LVF3rDed6w82f5LQfMDYZSoekPsqtQzVGOYDovAlJE/TC VmCmyIum9y/x/IVwYRAdiqmJLu3EsPtXbTxre38qt9Ba5523aYlhBBqBbuqnNS9dl9WU 0qAJP+FHqHlfzwOWW5nLyuWaDTso5jq165pKxv+ahBbkeq34+qjQdiCu8UtMRhU80vmt IsXYvdC6U0ZF0PIu/yOZitNgkmXGyW1foxBDYZ2E01JWlM+Hf4G/MzKs0AKlOj/msRsB gpEA== 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=ChIcbIgLJX/+eQRpKvWif40abxApwvOjyIFA0z+RMsM=; b=Qghna7UGMn0X971c7g5ZmH6XMNw1e+V6kw9fpz9G3NwbpOx/usIHfdYSokVSMz1K+s JWp/VnViXPQUNiqVGGTTsEaW7rkdoC86buFQK1PBuIOlBzj//b5VG9YNCJqmhnqdY7Cs MTmMVlR28siLW5dqFiJEEAA948P7W53WL8c5g13P2nkvWdRqrMgMxfvEkHWldL6afgfP tPJQEWlHPzm5/LQta2Bc3VD/ZzbwXYmcBHVY0yo9JcvDPzB8fTEyPne30/t5HNf8SsA1 NoE6CWpFBkbHOzrPCXpAGOaV6ciuVKAJVZRzryVU982x4yI/vxaHFdJiJnYJKRplHI2+ qdIQ== X-Gm-Message-State: AOAM5307D3tFIueSZqiPAcPpSO4Ik53tkyBQVpTDmERDckuQE9ANWQrF U84obVqBDLXiz+dDAh3ziQhRBhtpY8K+iw== X-Received: by 2002:a63:455e:: with SMTP id u30mr8136269pgk.401.1627355184784; Mon, 26 Jul 2021 20:06:24 -0700 (PDT) Received: from [127.0.0.1] ([203.205.141.116]) by smtp.gmail.com with ESMTPSA id p3sm913781pjt.0.2021.07.26.20.06.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Jul 2021 20:06:24 -0700 (PDT) Subject: Re: [PATCH] blk-throtl: optimize IOPS throttle for large IO scenarios To: Tejun Heo Cc: axboe@kernel.dk, cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <1626416569-30907-1-git-send-email-brookxu.cn@gmail.com> <957ab14d-c4bc-32f0-3f7d-af98832ab955@gmail.com> From: brookxu Message-ID: <34a6f4b5-9055-e519-5693-068f8dcb169c@gmail.com> Date: Tue, 27 Jul 2021 11:06:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tejun Heo wrote on 2021/7/27 5:46: > Hello, > > On Tue, Jul 20, 2021 at 12:35:54AM +0800, brookxu wrote: >> In order to avoid code duplication and IOPS stability problems caused by estimating >> the equivalent number of IOs, and to avoid potential deadlock problems caused by >> synchronization through queue_lock. I tried to count the number of splited IOs in >> the current window through two atomic counters. Add the value of the atomic variable >> when calculating io_disp[rw], which can also avoid the problem of inaccurate IOPS in >> large IO scenarios. How do you think of this approach? Thanks for your time. > > I guess it's okay but am still not a big fan of adding another hook. This is > primarily because blk-throtl is sitting too early in the stack - e.g. rq_qos > is doing the same thing but sits after the split path - and it's a bit nasty > to add an additional hook for it. > > Do you think it can be an option to relocate the blk-throtl hooks to the > same spots as rq-qos or, even better, make it use rq-qos? Make blk-throttle use rq-qos may be more elegant. But I found that there may be at least one problem that is difficult to solve. blk-throttle supports separate throttle for read and write IOs, which means that we cannot suspend tasks during throttle, but rq-qos throttle IOs by suspending tasks. We may be able to relocate the blk-throttle hooks to the rq-qos hooks. Since we may not be able to replace the throttle hook, in this case, if we register a rq-qos to the system, part of the blk-throttle hooks is in rq-qos and part hooks not, which feels a bit confusing. In addition, we may need to implement more hooks, such as IO merge hook. Thanks for you time. > Thanks. >