Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13476283ybl; Sun, 29 Dec 2019 12:49:48 -0800 (PST) X-Google-Smtp-Source: APXvYqyeEylyfFJF2v56D06E2OuoKB5eNaYVkUxW8SCno8Ijcg4oBAWmiUid99LRFjcqoyvhJGxX X-Received: by 2002:a05:6830:147:: with SMTP id j7mr71396164otp.44.1577652588896; Sun, 29 Dec 2019 12:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652588; cv=none; d=google.com; s=arc-20160816; b=upj6dqZDyivDfLzNdPsGEU05KrRolw0zMqdBaKI8Po6Ds0Ufo0E0Opb0uZmrBCPaux +x9OSsAnUcZkZ/GELvwfCQIGN+luMHCS9oMqIRlU2K2ROoU/DiMq8ZsalM+QcAqqTL6k qXZpGcMEgMOW5GlFHb4CcaqdI5vtQx8Q0Z/QkuLr5of15ScrXD/ZbMY7rH2Eilb8GKvc y7/HoOnwfZuLJllHODTFl43i4JIuXHu85QJ8hDApvMbjoTkrQj84iioIJA3Jjg66OGwM MGnTjb6FHh0rc6PQiRpFft7Nk3Z/l2ls3d97Lw73IOX/y1CMijfj1gLAPbKsF7z1Fpsn ytNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kpTLCP0Pg5vEKfKfUWVdnJ/vNVwA5W3j6wlHS4H34FQ=; b=dcYwdsECA/VqiHNU8oWlQjF9vSNHydVcquxOIQPVLXBzbrG3b2LQ7NH6Nvi3vc95bg i+AulRasCFmEcZVCVtSuynMtbVzAHMnk1LR+yZDB9nQBSkk1posBsqU8/IjUdE1a0bRG k65+sJhsgttRwPDrlN2q+q+8GkCqXDfMgF7CSUuFBZMJsNXXlsCPo/BXTfre59DfZAKW 1CQOMLoa3s+4bfg+jmX72UPqJSb1HESG9ggyhHTexr4z9+h6QfKRGDC+caOggrnqUtdn of8YrBrQtCqBAMOPVLXIZzWqi3N941anUj/OJMFxwtNSaXCKmHUQPNANmtPUITCK8y/c JUPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rStlHVHm; 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 m20si16581518otk.279.2019.12.29.12.49.37; Sun, 29 Dec 2019 12:49:48 -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; dkim=pass header.i=@kernel.org header.s=default header.b=rStlHVHm; 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 S2387447AbfL2R6B (ORCPT + 99 others); Sun, 29 Dec 2019 12:58:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:48836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732946AbfL2R56 (ORCPT ); Sun, 29 Dec 2019 12:57:58 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9406D206DB; Sun, 29 Dec 2019 17:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577642278; bh=EjjsqRq6XbMrEY0Znl/H+gw/v814XcT3VjQoYyQJzvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rStlHVHmpQg0VNXM3EKfHZe8jMrISU81HxLRCEGg6vMGY8M7qcf73FfSDB63Wfuvq Mz3TeMVPr7A3fqu9lc0RC26kz/DhtdJsAtCuQ5fmDLNRtGgz4k9VmmxtP0wuJt/iK2 OnxapwLqEqhy6WtA6opqC8NfGvUhk9Z0lD44PRVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Josef Bacik , Jens Axboe Subject: [PATCH 5.4 414/434] iocost: over-budget forced IOs should schedule async delay Date: Sun, 29 Dec 2019 18:27:47 +0100 Message-Id: <20191229172730.302581073@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tejun Heo commit d7bd15a138aef3be227818aad9c501e43c89c8c5 upstream. When over-budget IOs are force-issued through root cgroup, iocg_kick_delay() adjusts the async delay accordingly but doesn't actually schedule async throttle for the issuing task. This bug is pretty well masked because sooner or later the offending threads are gonna get directly throttled on regular IOs or have async delay scheduled by mem_cgroup_throttle_swaprate(). However, it can affect control quality on filesystem metadata heavy operations. Let's fix it by invoking blkcg_schedule_throttle() when iocg_kick_delay() says async delay is needed. Signed-off-by: Tejun Heo Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost") Cc: stable@vger.kernel.org Reported-by: Josef Bacik Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-iocost.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -1212,7 +1212,7 @@ static enum hrtimer_restart iocg_waitq_t return HRTIMER_NORESTART; } -static void iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost) +static bool iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost) { struct ioc *ioc = iocg->ioc; struct blkcg_gq *blkg = iocg_to_blkg(iocg); @@ -1229,11 +1229,11 @@ static void iocg_kick_delay(struct ioc_g /* clear or maintain depending on the overage */ if (time_before_eq64(vtime, now->vnow)) { blkcg_clear_delay(blkg); - return; + return false; } if (!atomic_read(&blkg->use_delay) && time_before_eq64(vtime, now->vnow + vmargin)) - return; + return false; /* use delay */ if (cost) { @@ -1250,10 +1250,11 @@ static void iocg_kick_delay(struct ioc_g oexpires = ktime_to_ns(hrtimer_get_softexpires(&iocg->delay_timer)); if (hrtimer_is_queued(&iocg->delay_timer) && abs(oexpires - expires) <= margin_ns / 4) - return; + return true; hrtimer_start_range_ns(&iocg->delay_timer, ns_to_ktime(expires), margin_ns / 4, HRTIMER_MODE_ABS); + return true; } static enum hrtimer_restart iocg_delay_timer_fn(struct hrtimer *timer) @@ -1739,7 +1740,9 @@ static void ioc_rqos_throttle(struct rq_ */ if (bio_issue_as_root_blkg(bio) || fatal_signal_pending(current)) { atomic64_add(abs_cost, &iocg->abs_vdebt); - iocg_kick_delay(iocg, &now, cost); + if (iocg_kick_delay(iocg, &now, cost)) + blkcg_schedule_throttle(rqos->q, + (bio->bi_opf & REQ_SWAP) == REQ_SWAP); return; }