Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4437749iob; Sun, 8 May 2022 12:45:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzJxoznb2lQz6OBEQsBmo2QPUzAV+hSzC3yUHMOUJNL2czlTd4Qox8Hd1U55d3xow9YQkN X-Received: by 2002:a17:907:7f1a:b0:6f4:6b52:adfd with SMTP id qf26-20020a1709077f1a00b006f46b52adfdmr11562851ejc.203.1652039110015; Sun, 08 May 2022 12:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652039110; cv=none; d=google.com; s=arc-20160816; b=z8Sy+A0tL+KmgDtCQ3s3Y5ecEKgDOtmG6bihklGT8S/sczCjcPzM1OeOzdG/93kR7O gJqS+SmskswV998PwCm/cyO83z/agQ2di1aquNsOMbp81W0kD2XyxG4j0ddAOI8IZJDV eO5/+2TjEAvh0BZIn5s8fMH2cpAHQOp4s04wOagFruR2YD913LV10LqaW3zIHuKT1XXF ssDfzcGcKKvqYMVZ3m6vtbo0TfI+EAfAxw6Wk2wv3wKBKrCzUlbjENPu7UEPPu4xJDGA 1FZGiWyfi7LTtiHx+W7WdGPZbDnQnBSYc129Pg11pR5y7wE7Jhr6LUPwPBRLuvIOwYAE qyIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k07tXpjgdrDTWIV9gTAHib5/nzftkFQe6xnyFCO2QPY=; b=GRFwW3+MHPMQC0GW/kG+M/h7cg2FC40TBY0pH6zH+SFm/GIKvWkYeCNOdvMDLFGQJi ZcHVRIQFBiKN8l+yeUNUzQJablPxZmLuuYBbeRxeMDfkCEhetk6K0KblngwNICqiuzcX D+NpeZhxyrGmvA1vgDTmJpUo2MWLSoZT2fPnIm2pjAAuvuJx2CYHPGcqlhe0Xwwphue+ 1m6iVfUXp/6bGRnv3RV93zKCQRu3H3xaeLtN5/NZfOQmvPrrwVxdJAuzs57ue0Z0G8Du oB12p4QnmKE2DXGnrgeZGP78dHce5GzPIu7/kQZEdL9KCnatV/gQfyK+HaSp21FSlrqs MwzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zHUq/5Vb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i22-20020a50d756000000b00425b188f7c7si9802688edj.426.2022.05.08.12.44.34; Sun, 08 May 2022 12:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zHUq/5Vb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358051AbiEDRiO (ORCPT + 99 others); Wed, 4 May 2022 13:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356870AbiEDRJr (ORCPT ); Wed, 4 May 2022 13:09:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AA7843EC9; Wed, 4 May 2022 09:56:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5D8DB8278E; Wed, 4 May 2022 16:56:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58B37C385A4; Wed, 4 May 2022 16:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683368; bh=UZl42qo5/Ar8qtWtm+NFa5TCzVY3jfja3ZRWVrYwy6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zHUq/5Vb76IsZii9KsVuMsu71qvVZc7r/b0HCLBZPg5WA4hswZb7R9Ir5wwlzQMfT C7rMZ0DIbCojpRu6P7yzwsw+w86/ZqEA78nQG8g5CbA1S5CYxXAxEQl1Lu0+AMTGv+ cYf2h9kgFXANEkAQo+3AriGZRmvwnqYkHl776mo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Rik van Riel , Jens Axboe Subject: [PATCH 5.17 053/225] iocost: dont reset the inuse weight of under-weighted debtors Date: Wed, 4 May 2022 18:44:51 +0200 Message-Id: <20220504153114.897394089@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153110.096069935@linuxfoundation.org> References: <20220504153110.096069935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tejun Heo commit 8c936f9ea11ec4e35e288810a7503b5c841a355f upstream. When an iocg is in debt, its inuse weight is owned by debt handling and should stay at 1. This invariant was broken when determining the amount of surpluses at the beginning of donation calculation - when an iocg's hierarchical weight is too low, the iocg is excluded from donation calculation and its inuse is reset to its active regardless of its indebtedness, triggering warnings like the following: WARNING: CPU: 5 PID: 0 at block/blk-iocost.c:1416 iocg_kick_waitq+0x392/0x3a0 ... RIP: 0010:iocg_kick_waitq+0x392/0x3a0 Code: 00 00 be ff ff ff ff 48 89 4d a8 e8 98 b2 70 00 48 8b 4d a8 85 c0 0f 85 4a fe ff ff 0f 0b e9 43 fe ff ff 0f 0b e9 4d fe ff ff <0f> 0b e9 50 fe ff ff e8 a2 ae 70 00 66 90 0f 1f 44 00 00 55 48 89 RSP: 0018:ffffc90000200d08 EFLAGS: 00010016 ... ioc_timer_fn+0x2e0/0x1470 call_timer_fn+0xa1/0x2c0 ... As this happens only when an iocg's hierarchical weight is negligible, its impact likely is limited to triggering the warnings. Fix it by skipping resetting inuse of under-weighted debtors. Signed-off-by: Tejun Heo Reported-by: Rik van Riel Fixes: c421a3eb2e27 ("blk-iocost: revamp debt handling") Cc: stable@vger.kernel.org # v5.10+ Link: https://lore.kernel.org/r/YmjODd4aif9BzFuO@slm.duckdns.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-iocost.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2322,7 +2322,17 @@ static void ioc_timer_fn(struct timer_li iocg->hweight_donating = hwa; iocg->hweight_after_donation = new_hwi; list_add(&iocg->surplus_list, &surpluses); - } else { + } else if (!iocg->abs_vdebt) { + /* + * @iocg doesn't have enough to donate. Reset + * its inuse to active. + * + * Don't reset debtors as their inuse's are + * owned by debt handling. This shouldn't affect + * donation calculuation in any meaningful way + * as @iocg doesn't have a meaningful amount of + * share anyway. + */ TRACE_IOCG_PATH(inuse_shortage, iocg, &now, iocg->inuse, iocg->active, iocg->hweight_inuse, new_hwi);