Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4668823iob; Sun, 8 May 2022 21:18:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUxRaim059cCQ73rHxJiptrajquWAJQE4FwDc88AOFAF+I9VY+ZMZCwVBEvFlMPqF8wkRt X-Received: by 2002:a17:90a:cc0a:b0:1dc:9a3a:6eef with SMTP id b10-20020a17090acc0a00b001dc9a3a6eefmr24553463pju.127.1652069910226; Sun, 08 May 2022 21:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652069910; cv=none; d=google.com; s=arc-20160816; b=gmFgVOf7X1froplcCqRSSriK2oWMPhRGFUDuEcp2JDdn4XFqbezX8bg2yFP6WNKL86 ZUub1EfVKmg1vgMnVCX0kc9D/zaYUZTsRodoS46ZJZ7fVtcoCI+iJ+HCz1vJQ+2sDTGV VezNR3L6cRhs7R4JpuolJedIZNfDSLDrYgmpMLLfSvgj411ORTiMZ0zWd514MQHIf+OV YEhjpQXXRllU4ExrYHtOuvpALayP5L3w+egZzzmRJ+E/Kd+JIFzkNJX4ugNtLO6GfvKr DWwh8hzv3KQvS8GhjzpxsG5alT5auGNrJ1NOCYw4h9wIsbWpY7cMjyOHiI6+4pV3KLCG h8Eg== 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=z+HoLKfKUHBE0ugAVpppDYP6uMBky6VoQ10yOcb9hWE=; b=fo3q/Y2Xl5wcEek7DFX4CpcxcQhuuyh/zgSLl+bMAFA5VfIlD3BLeYo4hwcct3Mpoj 64qwaS98bI43Hd+DSD3wFewBinEumzcF66MfUjGQ8Uyq0Vfu7b6RdHC2PK/E079bVroB GTZ3yf0DoAwc86BHRkw2eJaoa5VswkWj+eaac9vW4RroWS39e54NVcas5PCeheqNDz5K GSfzMlggITIaZS0n5R07eHMQR7xokSKOQSSPehFmGqAkgVW+Gt121+Fhs9/kNH9Yr+ok qNCcPx7Um4ZzozqCfRlPhNtaR0PgswwR7+UfiKYkiIPBfdGBCUOASlEfZrAo7TG85BwQ KpSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1NcIegnK; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x189-20020a6331c6000000b003ab616774basi12915470pgx.799.2022.05.08.21.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:18:30 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1NcIegnK; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D5D4C11664B; Sun, 8 May 2022 21:15:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356007AbiEDREu (ORCPT + 99 others); Wed, 4 May 2022 13:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354605AbiEDQ6y (ORCPT ); Wed, 4 May 2022 12:58:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F2F32314C; Wed, 4 May 2022 09:50:48 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6E02A617BD; Wed, 4 May 2022 16:50:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B74C385A4; Wed, 4 May 2022 16:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683046; bh=humWjBXg5Qfpu/Xg7rjSgbiOYu3/AmTCV30mt2Nvlxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1NcIegnK9TrAg7GTU+RKDTQ5uk1aG4DzrHyAEJxQrcAfs5kjl9zUwej3cYwX6iDzX JxFfYmmtfV7nfW/ZCLpW610x9J4BhYsYmxQoRoycav69haRtwIBnFnxyQkr5MiZqjo dGxyOljmE8AzZj549JOEdjE5KfnHcwH+AnCS1I98= 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.10 037/129] iocost: dont reset the inuse weight of under-weighted debtors Date: Wed, 4 May 2022 18:43:49 +0200 Message-Id: <20220504153024.146447116@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 @@ -2257,7 +2257,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);