From patchwork Mon Feb 5 19:35:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10201593 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 EBD5F602CA for ; Mon, 5 Feb 2018 19:35:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB4B028617 for ; Mon, 5 Feb 2018 19:35:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFE3C287C6; Mon, 5 Feb 2018 19:35:25 +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=unavailable 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 7A9EB28617 for ; Mon, 5 Feb 2018 19:35:25 +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 078BA5243; Mon, 5 Feb 2018 19:35:24 +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 8A4B3620D7; Mon, 5 Feb 2018 19:35:23 +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 E145D18033D9; Mon, 5 Feb 2018 19:35:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w15JZLdP002201 for ; Mon, 5 Feb 2018 14:35:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6F8FE608F0; Mon, 5 Feb 2018 19:35:21 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64F4D608EE for ; Mon, 5 Feb 2018 19:35:11 +0000 (UTC) Received: from mail-io0-f193.google.com (mail-io0-f193.google.com [209.85.223.193]) (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 1310E81DEE for ; Mon, 5 Feb 2018 19:35:11 +0000 (UTC) Received: by mail-io0-f193.google.com with SMTP id t22so31456046ioa.7 for ; Mon, 05 Feb 2018 11:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dYQANOyO+nCfpt6c15KUu+4qxAAnBJe1ucEsbmDniQA=; b=qgHsYj4WCKIku4YymoiKFrDMvHC3YjD+2VyU/wvjJMeVK/V6tVVFSBn3Cux5cZh4P8 byRvRYYTQGHyZhIOX4KcMelHe7Xsi6ISsclzd30x6829Sa430m+i0LtJm+Vu5deG2Ipz 9ShUEbulWNp7D/iQ7cToT2Iz+iZHHyCnthGcVC7EG+u5iuGfWeXFXyqBJSDqpoMl5l/4 NfQr0gQ23ofqfXC0epYlaCCqe7kwZ9/GHhpn1EAvNHaNjEM2YPMXI/keH64h0wXNUUWh gDXDjPVhWC1ohXw9RQBsoQ4ms9MvDjtK4+HtRydD/yx5Lh1m5DebJZ/ydx+Qfw41Akt3 GsYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dYQANOyO+nCfpt6c15KUu+4qxAAnBJe1ucEsbmDniQA=; b=jU4vQBZMfVp0w5r1pGdgbI7GMg+OHVUli3QMpgWBkR/gD8e2jeCcCB+m3DLs7FeP69 ls1WdKXkVoKxYoewtuz6KWZkbywMbG2kOwWD+EZk1PXSDGL7kGZiLxLjWLVJxJV2PMzS MBRHehhGTx8qu3KpZ8qjKC6B8Ca9oOqtQ/sDbpgFVACdOUY1WOpcv6yY8XM8e7XdkmIA 27NAs1S3+DmsiaH0dt6Xznlc2le9vgXnHHrxMBKI+NrQKVSSQpT3DE9rWRjZpm0Ud1Cs r94niGHy5ojAcDIN32RTsNe9abtFdpuPECl6yos4FVdXGWDblbDQxfX8HNY+0L8/WzPG WrZw== X-Gm-Message-State: AKwxytcdFChOoP0NqKPDUMo51oUIl3gsrF03qEMrGVOLoVeJ4T6L8h5S lwlHWwd0xvefEJ4AMZvHxwmMZHZwwkg= X-Google-Smtp-Source: AH8x2261LdiQFMoTeGbZBakE/OGtZ0gT+/nJ0QdAIsyAbiGwK+1Gqfw8aGQBtTWoktT2Hka4oyJLXQ== X-Received: by 10.107.15.143 with SMTP id 15mr53648278iop.118.1517859309921; Mon, 05 Feb 2018 11:35:09 -0800 (PST) Received: from [192.168.1.154] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id t123sm5706485itb.14.2018.02.05.11.35.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2018 11:35:08 -0800 (PST) From: Jens Axboe To: Mikulas Patocka References: <33d2d1ab-d57e-8a3f-94df-e79704b5d863@kernel.dk> Message-ID: <6bf3dd42-eb4a-8408-eb09-3b6c4dd18354@kernel.dk> Date: Mon, 5 Feb 2018 12:35:07 -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: <33d2d1ab-d57e-8a3f-94df-e79704b5d863@kernel.dk> Content-Language: en-US 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:35:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 05 Feb 2018 19:35:11 +0000 (UTC) for IP:'209.85.223.193' DOMAIN:'mail-io0-f193.google.com' HELO:'mail-io0-f193.google.com' FROM:'axboe@kernel.dk' RCPT:'' X-RedHat-Spam-Score: -0.012 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.223.193 mail-io0-f193.google.com 209.85.223.193 mail-io0-f193.google.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.27]); Mon, 05 Feb 2018 19:35:24 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP On 2/5/18 12:22 PM, Jens Axboe wrote: > 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. Thinking about it, flush should just be counted as writes, and the rest disregarded. Ala below. diff --git a/block/blk-wbt.c b/block/blk-wbt.c index ae8de9780085..f92fc84b5e2c 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -697,7 +697,15 @@ u64 wbt_default_latency_nsec(struct request_queue *q) static int wbt_data_dir(const struct request *rq) { - return rq_data_dir(rq); + const int op = req_op(rq); + + if (op == REQ_OP_READ) + return READ; + else if (op == REQ_OP_WRITE || op == REQ_OP_FLUSH) + return WRITE; + + /* don't account */ + return -1; } int wbt_init(struct request_queue *q)