From patchwork Mon Jun 14 10:28:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 459832 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3190883jae; Mon, 14 Jun 2021 04:24:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjoz3PfoEImaY3btMSgdPvQhNk0fWULclZT82OZwffxm/34zCaERh5XJe8izJ0VRbxuNu2 X-Received: by 2002:a05:6402:6d1:: with SMTP id n17mr16596339edy.116.1623669870068; Mon, 14 Jun 2021 04:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669870; cv=none; d=google.com; s=arc-20160816; b=WTMR3qZ3lJKsNkwrgbhP9+uglfRMQqKfenve7DiN1e9lQyGJXlYMppTb0wZI5ih0pC uruMyB0vkiyj+C5BYNJ3ZE5WB7EGtaapE8JVtb7bNeP6NdGvw/2dcXLEk1pYXWOCXaiY h7JwdhhWaG2N0MtIMDvX2i8jOHiwqor4Zgti6ohr4Oc4lom5hOjvSGG45bdmZSX8zay6 9ofSIAJI05SMzYgGkOdTdoHrHqjh/4zzLNH9USKsqUkOWpxzcpRZPPt/uKPhtWnRH1IT F1Dzm8HeyWW0HJWUE9RJRi3IxZHJmkhVx3nGEguvR7Ofr4olISQsTF8MGFYRuACTifCd GhZA== 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=/Qe75hiFQmfJN3eHdCweT0LE9lnTk6cBzv3yn5m74j4=; b=sjT8QP4B33O3C54Z/UZSpmFOEt4VEjeDxuhiFX1D5Gnit2LGictFOenf3wM9TCysDI GsNUCIUtg0XEdViIAE2J48RDojD48jyOJiVv+zznJX//GHWNSyAJqzOHnjdjfYYNHX5B /80KJk5QCOLQc452z7dQg2VWv6nnb7NT+kt3TRexdGqXAD3HAWMSwevePOJRip/KRWm5 dnQ9tvdFvG7UGruWnTGDdLZwhebP0ysIEhyhoFYcN6doKFSEUMc7dBy7KIHBY/JCsLim B5VeJ0wGso5atxW89elcuJOrR6SvTuBWR6bpj4D+t0j4CNLUyx8IMZMOZj/UBy5F9e5e i3ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="jkK/Y+Uc"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si7011152ejc.423.2021.06.14.04.24.29; Mon, 14 Jun 2021 04:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b="jkK/Y+Uc"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S234053AbhFNL0I (ORCPT + 12 others); Mon, 14 Jun 2021 07:26:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:50444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235941AbhFNLYE (ORCPT ); Mon, 14 Jun 2021 07:24:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 224056140B; Mon, 14 Jun 2021 10:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667999; bh=ZeolnNeHAsD23tiJ+VYHj1ILRD6OzkoNPrJA6e5kj/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jkK/Y+UcHZPcw+SN9aAHgxaWfZTa1de8A4gnQuDPwmDJGeJhivHjgbiDEAkhWOECX asKGD5e3J4qkKndHim8WnX1wQHgRwpitMAprEbqMhTAyaOnhqGtR4ZhKmUVo0OyEbz goiAH3h7jkRR9+Isd/P5UbgvECicm4jg8Bcbc8RM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Odin Ugedal , Vincent Guittot , "Peter Zijlstra (Intel)" Subject: [PATCH 5.12 155/173] sched/fair: Make sure to update tg contrib for blocked load Date: Mon, 14 Jun 2021 12:28:07 +0200 Message-Id: <20210614102703.323815507@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102658.137943264@linuxfoundation.org> References: <20210614102658.137943264@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vincent Guittot commit 02da26ad5ed6ea8680e5d01f20661439611ed776 upstream. During the update of fair blocked load (__update_blocked_fair()), we update the contribution of the cfs in tg->load_avg if cfs_rq's pelt has decayed. Nevertheless, the pelt values of a cfs_rq could have been recently updated while propagating the change of a child. In this case, cfs_rq's pelt will not decayed because it has already been updated and we don't update tg->load_avg. __update_blocked_fair ... for_each_leaf_cfs_rq_safe: child cfs_rq update cfs_rq_load_avg() for child cfs_rq ... update_load_avg(cfs_rq_of(se), se, 0) ... update cfs_rq_load_avg() for parent cfs_rq -propagation of child's load makes parent cfs_rq->load_sum becoming null -UPDATE_TG is not set so it doesn't update parent cfs_rq->tg_load_avg_contrib .. for_each_leaf_cfs_rq_safe: parent cfs_rq update cfs_rq_load_avg() for parent cfs_rq - nothing to do because parent cfs_rq has already been updated recently so cfs_rq->tg_load_avg_contrib is not updated ... parent cfs_rq is decayed list_del_leaf_cfs_rq parent cfs_rq - but it still contibutes to tg->load_avg we must set UPDATE_TG flags when propagting pending load to the parent Fixes: 039ae8bcf7a5 ("sched/fair: Fix O(nr_cgroups) in the load balancing path") Reported-by: Odin Ugedal Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Odin Ugedal Link: https://lkml.kernel.org/r/20210527122916.27683-3-vincent.guittot@linaro.org Signed-off-by: Greg Kroah-Hartman --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8005,7 +8005,7 @@ static bool __update_blocked_fair(struct /* Propagate pending load changes to the parent, if any: */ se = cfs_rq->tg->se[cpu]; if (se && !skip_blocked_update(se)) - update_load_avg(cfs_rq_of(se), se, 0); + update_load_avg(cfs_rq_of(se), se, UPDATE_TG); /* * There can be a lot of idle CPU cgroups. Don't let fully