Received: by 10.223.185.116 with SMTP id b49csp1020191wrg; Wed, 21 Feb 2018 10:41:05 -0800 (PST) X-Google-Smtp-Source: AH8x225t7+iNWnRLNx4bLj3LvuR3skPXreZiC+ZI/T/ZyYKhqblG89klZUQ9WiE1X3lz/9BUKozS X-Received: by 10.99.170.73 with SMTP id x9mr3436282pgo.393.1519238465329; Wed, 21 Feb 2018 10:41:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238465; cv=none; d=google.com; s=arc-20160816; b=q0slepuGcsfQO/r0l91xIYb90Fmr4ZbzfWsxhxkIVFQC+GNUlrYoPCPXE1VOqMjzZT 0rYG2T6jCkOxV4l7RdMd/EJ2nxx9TZXdkJAgW+MzrBDqwe+DoX9stnaH+HhRLViqxpXg 8IQaP9U/fxLOTJewdUfuhn0jP9pX0pSlAU1nz+Ol+UOT8fkuQ511eU/qvNnpVvxfMRYM YC0cCu7P9qo86ep+TyPMuA/NXe4463cKOZQG1ex07wHpAEhuu3aUJqlgjbFBXoGsAwOv k+45qmbj76r8inzh4PvCg2/I91EGlDb0gns5Oac8oX7iTYq4dFzD+HzuS3XcTcr288Us tggQ== 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=MY/P3unxPBbIzyhlt4WbutU2M7OQkcfLMQiZ3COd8ik=; b=Hde1+oc78n3wzoqcpnmwKQJYle+CD4i/WcAAmjRcYJWnMTY7H3vWtbZmKw2e80T2EB TESxxZNZPtY8WmkRbYtf31blXJAGIHmurULt9d6qbKxzXr9/6iiyaTDne2s23qcZgN3O 2xpudV3chNQCZCBhfW/VvcI2HcfpmL+Oam3eXV2V2oCdV3onIdFhqx7KaxKimqcEO0Px avP7h+vf+5qvO2epYyIrrXduuVFfq9hJyHnIywzsfhaI0Sf51FKYRGB/myPTsTXegck9 G9c7Z6krT0BnIwd4Z4b1Nn6OBORtf/laVsiYbrQqIiaP62wu3CtQUsZsepyueYcmx0Xw gOcA== 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 g128si8504774pgc.574.2018.02.21.10.40.51; Wed, 21 Feb 2018 10:41:05 -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 S1754068AbeBUNT3 (ORCPT + 99 others); Wed, 21 Feb 2018 08:19:29 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45628 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752558AbeBUNMX (ORCPT ); Wed, 21 Feb 2018 08:12:23 -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 9D17C1061; Wed, 21 Feb 2018 13:12:22 +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.15 131/163] blk-wbt: account flush requests correctly Date: Wed, 21 Feb 2018 13:49:20 +0100 Message-Id: <20180221124537.408578112@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-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 @@ -697,7 +697,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)