Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1672736pxj; Wed, 19 May 2021 11:08:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo8I8roMtWllpJMlOPxlM3i1KMxM0d47m7Up3D6rdXSIWFa1QflRw1qONPr8l1/9AwpTKH X-Received: by 2002:a05:6e02:13a8:: with SMTP id h8mr280094ilo.82.1621447689679; Wed, 19 May 2021 11:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621447689; cv=none; d=google.com; s=arc-20160816; b=QMYznMYOtLvxLTI6nWN42IXyRz9y1t30WhCV0O9u/c0waqHc1z7VhB2DHVVL48v6st Y7fpMYY9eI32ok/nDbWB+VfRBMO7ud6Ot1PJXXLtw2+UAMfedac7NoEVevfmmYH1A+ZY 4FmnQuQpterWoEUINSUJ7JG0pcobuzNmpYYXAuoQRol4xxi+AhVjmI0kDgvRs5GL6G4d 3xYVTxG226z+F96En/A4qoCrLsgYiD//piuLRAJSMaVUkBSCcXmq1ydS3s7IJdlRxqKY NQ1UU+Z/yPig8RpNuEIwJsoTatZ2QW5nsFAcPldw/SfGl+oCrAyYnceyMUk3L+2R0WhF jW0Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K2m3StdkgN8j9sX0OOQRA/hs3X95klSzDGXdeM8HTJY=; b=QZZmOSviipsz+hhZXy95xb+EzEnMQmAImmJ+Z20zMxQfi2bJMi+OxHs26ulK8mKaQJ 9J65i5Fh9ADLcIxJ2e7E7e6dlWjfXycuiT96eNMq7Q+YHtrQlRhYrzWLrgh9v7BuWA0T D2uTNcvFcZk7e1txGXfrPbaoX5zdIVwBmNaLDVVFmB+13J4kOR6eQX8I3H9dtviseCS/ yDzp4rYX/RqZw5ZmeAgx1FIpi431UYIcXj0M/Xqkmo/VoRPL9yvX5Sk5Y/Clp/TlCCId Gghtq0lEL7WNilA7dLWcdmcSgmg9ydXeEMH8tzh+U/sM8YGwkIU9b3l0wjk0C/Fp//uj Fz/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@uged.al header.s=google header.b=vtTYi9jf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i13si424185ilm.45.2021.05.19.11.07.55; Wed, 19 May 2021 11:08:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@uged.al header.s=google header.b=vtTYi9jf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349397AbhERM4U (ORCPT + 99 others); Tue, 18 May 2021 08:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349394AbhERM4R (ORCPT ); Tue, 18 May 2021 08:56:17 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7EA9C061573 for ; Tue, 18 May 2021 05:54:57 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id p20so11415220ljj.8 for ; Tue, 18 May 2021 05:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uged.al; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K2m3StdkgN8j9sX0OOQRA/hs3X95klSzDGXdeM8HTJY=; b=vtTYi9jfJ+11Q8gjuzRabIbIUKKJyqDw2pUtj9GyYq0ftsy8WpejQqwF/PaksTkvyc E67MK7KCFtAD9K0Vzv1M8Bxsab4LMuvS1BFcFPicbl5vVl3wbbg36Rvy4C+mDBjmJWnU i1RHd6XsD+eheHVLbo1owEAmQdFFLNNmdDC/E3b4o9TVqEUdUGNmZBciHKjvhzGYXx2U AIsi+38lT8vu7gcHLdsPM8FJgXs+ZwIwAZFzksPlw5AudK7uFdgkTsCL23j3PHM4mR4r xVgDiSS6Vw4y+5jBPhFcNKOUwUSB3g6F23BHUHqi8eSvL4iStYz5xcleD5fjYA5zces/ KggA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K2m3StdkgN8j9sX0OOQRA/hs3X95klSzDGXdeM8HTJY=; b=C2pccaZr+JWiXxG4JLsTFwl5QTjbHXoGY658T4JAhm4Q2ao9EtAwUtscbgg3ENu8kA lssClDEH2io0ZcNZ/aNogsSGFjVeF7M00LkJSCIcfYpo/zR8N6/dHy0EU5CC4ZvubkRD +lwK65B91U0BKWORZoK6ujv7xG88dMh9KR7RIr+2MMGLnwwBt7XDnYB+xDdiuOZvzUTj 6AKXYljvrUHl1acPyzlbeLd4pHzmqb7NkNLLD29wm9Kn0fcrQ003PBYvW+uki/1Tl+Vd 6VtOKQu1l6cA42to03rHYY4eXD5h4WNc4DDT5kp4VZ/YpCuilRBh4fJ7dxVNlx9vele+ chEg== X-Gm-Message-State: AOAM530aY8PXHqWm+bze7TxbVUvS190HtzDOlixVs4Tw2iySIGQZoIqz 1bKLq8CusydqAF54W0aSeAr0ag== X-Received: by 2002:a2e:86cc:: with SMTP id n12mr3761996ljj.457.1621342496269; Tue, 18 May 2021 05:54:56 -0700 (PDT) Received: from localhost.localdomain (ti0005a400-2351.bb.online.no. [80.212.254.60]) by smtp.gmail.com with ESMTPSA id v14sm2265898lfb.201.2021.05.18.05.54.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 05:54:55 -0700 (PDT) From: Odin Ugedal To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Odin Ugedal Subject: [PATCH 1/3] sched/fair: Add tg_load_contrib cfs_rq decay checking Date: Tue, 18 May 2021 14:52:00 +0200 Message-Id: <20210518125202.78658-2-odin@uged.al> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210518125202.78658-1-odin@uged.al> References: <20210518125202.78658-1-odin@uged.al> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make sure cfs_rq does not contribute to task group load avg when checking if it is decayed. Due to how the pelt tracking works, the divider can result in a situation where: cfs_rq->avg.load_sum = 0 cfs_rq->avg.load_avg = 4 cfs_rq->avg.tg_load_avg_contrib = 4 If pelt tracking in this case does not cross a period, there is no "change" in load_sum, and therefore load_avg is not recalculated, and keeps its value. If this cfs_rq is then removed from the leaf list, it results in a situation where the load is never removed from the tg. If that happen, the fiarness is permanently skewed. Fixes: 039ae8bcf7a5 ("sched/fair: Fix O(nr_cgroups) in the load balancing path") Signed-off-by: Odin Ugedal --- kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3248e24a90b0..ceda53c2a87a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8004,6 +8004,9 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) if (cfs_rq->avg.runnable_sum) return false; + if (cfs_rq->tg_load_avg_contrib) + return false; + return true; } -- 2.31.1