From patchwork Mon Feb 5 19:22:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10201573 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE3BA6056A for ; Mon, 5 Feb 2018 19:29:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCB8120121 for ; Mon, 5 Feb 2018 19:29:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D14FA28761; Mon, 5 Feb 2018 19:29:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 47C5920121 for ; Mon, 5 Feb 2018 19:29:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 96F8281E1A; Mon, 5 Feb 2018 19:29:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36CBE605DF; Mon, 5 Feb 2018 19:29:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3A93E18033D9; Mon, 5 Feb 2018 19:29:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w15JMNLg032012 for ; Mon, 5 Feb 2018 14:22:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 88A175EDEB; Mon, 5 Feb 2018 19:22:23 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80CA45D75F for ; Mon, 5 Feb 2018 19:22:21 +0000 (UTC) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A2964A71B for ; Mon, 5 Feb 2018 19:22:20 +0000 (UTC) Received: by mail-it0-f50.google.com with SMTP id u62so17971506ita.2 for ; Mon, 05 Feb 2018 11:22:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3wf71/3yermz2K44dYw2r9FTgJJgjBkmSK3P5tL8lNo=; b=ER7Lfs6ruI9IEUovoPCVasYS5qPL9zy9rOdPwEslJsgv17tbte4NTGl7YPVtaX1EI4 NFBl+SS5E+Ie27pLtcW9ln9heEM/ok5bleDaPF2fIjRSlDfBwA4vO7iBN7q2PpGKOBj/ Fi+0kxIdlALqkBpjyK93AN+WJ3Xjq0h3vLxdx7FUshUpmNfQxOxuSrj+VBVgtGsOmNeG WmqxBl+26ABkaNMaoUgIIonxaoH3FphLG1BFgOHJ44Sq68e6tZKTikUiw1mD4VfUjr8i 92QTfu2r+SegxakBXlCEuuwJKRQ9BRTjtajjzUOHyi5OtnvNcKawjzm7uJ/HduiNBNgB 64+g== 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=3wf71/3yermz2K44dYw2r9FTgJJgjBkmSK3P5tL8lNo=; b=fSP2NMe4PmN7o/uy+pNVduvBoieF1QwhvRsRmyFnyHOuGohCiTMoGQVP8KHdsak4an Ow0wPFDAcmG5LVoPVd3w+v26JxnutFFNMF5K/OH3LvFTW8U0ppzIinDjod8yZaEP7kLL LNiRBCDh53uvA2nL6PwyLKPNXR5C8Zckl0OXAfnPa0g1Y8rvUscrHRtEkFoCZiu/arxm zs+6DdJm4p7jwWhZ6mhM5gT/YWjtB9xMnvZHegH7yaOOJL+TWMdgIZV7kcOGGUJC42Q1 EBdigI8PAKWcX5bOotnoimKn2N728iySPAiqoYFpClBS1wK0jai3kjlHI/1c2bu2ZyxN 7zHw== X-Gm-Message-State: APf1xPC2bitYI84WxRhk/LCQDdN5699J71qi1D3kID6VnGzJVY8SNmsB qEwHAm3yNXXLO1FA18rh6yLOo5Xl2Mo= X-Google-Smtp-Source: AH8x224/ATYRigLecTd3WTLN2pOQsNwlHr3QS/jKvoxCHH8jtg7m85I/9xcr7ek6GvsqFNTOkFXE1Q== X-Received: by 10.36.208.22 with SMTP id m22mr559394itg.52.1517858539286; Mon, 05 Feb 2018 11:22:19 -0800 (PST) Received: from [192.168.1.154] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id w69sm5615079itb.35.2018.02.05.11.22.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2018 11:22:17 -0800 (PST) To: Mikulas Patocka References: From: Jens Axboe Message-ID: <33d2d1ab-d57e-8a3f-94df-e79704b5d863@kernel.dk> Date: Mon, 5 Feb 2018 12:22:16 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Thunderbird/58.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 05 Feb 2018 19:22:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 05 Feb 2018 19:22:20 +0000 (UTC) for IP:'209.85.214.50' DOMAIN:'mail-it0-f50.google.com' HELO:'mail-it0-f50.google.com' FROM:'axboe@kernel.dk' RCPT:'' X-RedHat-Spam-Score: -0.721 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.214.50 mail-it0-f50.google.com 209.85.214.50 mail-it0-f50.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: linux-block@vger.kernel.org, dm-devel@redhat.com Subject: Re: [dm-devel] [PATCH] wbt: fix incorrect throttling due to flush latency X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 05 Feb 2018 19:29:37 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP On 2/5/18 12:11 PM, Mikulas Patocka wrote: > I have a workload where one process sends many asynchronous write bios > (without waiting for them) and another process sends synchronous flush > bios. During this workload, writeback throttling throttles down to one > outstanding bio, and this incorrect throttling causes performance > degradation (all write bios sleep in __wbt_wait and they couldn't be sent > in parallel). > > The reason for this throttling is that wbt_data_dir counts flush requests > in the read bucket. The flush requests (that take quite a long time) > trigger this condition repeatedly: > if (stat[READ].min > rwb->min_lat_nsec) > and that condition causes scale down to one outstanding request, despite > the fact that there are no read bios at all. > > A similar problem could also show up with REQ_OP_ZONE_REPORT and > REQ_OP_ZONE_RESET - they are also counted in the read bucket. > > This patch fixes the function wbt_data_dir, so that only REQ_OP_READ > requests are counted in the read bucket. The patch improves SATA > write+flush throughput from 130MB/s to 350MB/s. Good catch. But I do wonder if we should account them at all. It might make sense to account flushes as writes, but we really should not account anything that isn't regular read/write IO related. Something like the below? Potentially including REQ_OP_FLUSH in the write latencies as well. diff --git a/block/blk-wbt.c b/block/blk-wbt.c index ae8de9780085..55671e5f3b6e 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -697,7 +697,13 @@ u64 wbt_default_latency_nsec(struct request_queue *q) static int wbt_data_dir(const struct request *rq) { - return rq_data_dir(rq); + if (req_op(rq) == REQ_OP_READ) + return READ; + else if (req_op(rq) == REQ_OP_WRITE) + return WRITE; + + /* don't account */ + return -1; } int wbt_init(struct request_queue *q)