Received: by 10.223.185.116 with SMTP id b49csp1027053wrg; Wed, 21 Feb 2018 10:48:36 -0800 (PST) X-Google-Smtp-Source: AH8x226FAD4J6C4QaN4wPx1JnS9jf899rVorJ3evOCsHqr4SSW9NcLlOyixE7aQO8ueANHNHZHO2 X-Received: by 10.98.9.130 with SMTP id 2mr4201105pfj.149.1519238916811; Wed, 21 Feb 2018 10:48:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238916; cv=none; d=google.com; s=arc-20160816; b=cx9mFNYsu5PlY4IEUCKCnnLnlvCKj+aymWAYseG0WfA6aPUGw2UcwKWaXNs0N/M3B1 rnRvNYutqxd/X6FE4rlP8gzmQVhWnWnuiCh7lgsm9z+RO1bPI1Sj9LKsT8saSQUskDIU 8HTvXcTLPfNComP6aooHAXAdvHYlJqsnZm40N++hd/vh0/uqe3SZStWCBynDPTJI8qE5 +yvCWgLHRKgn7c1jz7pt/XoGknllypWd8pmuSu382gq/Ri5yp6Ai6e8DnP/Ftgsa8ZfA adkrl9R1jnR/1uMkD/hrwdWbi9Jb/XWS41X8h53onWDOSrtRp6PVxMDYj/vEoq5kNSna upng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=MDChoz2qIOecVNdcAcBU+VbItArJCFnVpy9Toj0fM1I=; b=Z4PkyvIeJh9PenzBbmJK2Tex/BQiXv/mpNI8WlWOSjwHtuxKSCIkPDVFxJdx9cuRL+ ZMWrQvg9kyFCf1Ya4tD+C3tHBNKAzkjsVw4Cdvdp8Pv1PC2LdVxHzgkwwaVQfDPNVcxI Egvrr1zzmoHFbEEbS61rjzAj+pHEYmASHLyaZXxj5hMVhaWO3eerJIE7e8R7jb0g6bgg INjqqL+fC33YmzeRlfyOB2oGj9AiSh+dpGtrs23zx7aqcG0I1nkaTE5JJhMLjX34RPLs CiWXl8MLt0dWnaSyIJyYInh1uGzQweYV+QAcDmQsSL48t3ut7609Hp4eDdOuUSWTaIUm GG5g== 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 v189si1653132pfv.341.2018.02.21.10.48.22; Wed, 21 Feb 2018 10:48:36 -0800 (PST) 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 S965847AbeBUN76 (ORCPT + 99 others); Wed, 21 Feb 2018 08:59:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39628 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935772AbeBUNDl (ORCPT ); Wed, 21 Feb 2018 08:03:41 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1ED46E4A; Wed, 21 Feb 2018 13:03:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Jens Axboe Subject: [PATCH 4.14 130/167] blk-wbt: account flush requests correctly Date: Wed, 21 Feb 2018 13:49:01 +0100 Message-Id: <20180221124531.735046708@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jens Axboe commit 5235553d821433e1f4fa720fd025d2c4b7ee9994 upstream. Mikulas reported a workload that saw bad performance, and figured out what it was due to various other types of requests being accounted as reads. Flush requests, for instance. Due to the high latency of those, we heavily throttle the writes to keep the latencies in balance. But they really should be accounted as writes. Fix this by checking the exact type of the request. If it's a read, account as a read, if it's a write or a flush, account as a write. Any other request we disregard. Previously everything would have been mistakenly accounted as reads. Reported-by: Mikulas Patocka Cc: stable@vger.kernel.org # v4.12+ Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-wbt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -698,7 +698,15 @@ u64 wbt_default_latency_nsec(struct requ 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)