Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2652745pxj; Mon, 14 Jun 2021 04:06:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfQD2KglPcYujsBzIkXLmkGV60RLQ+CwD+md2Nx8QzYiXwi3Kh7qtNC1Gjjg7k4b980o63 X-Received: by 2002:a17:906:6d14:: with SMTP id m20mr14291792ejr.504.1623668786654; Mon, 14 Jun 2021 04:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623668786; cv=none; d=google.com; s=arc-20160816; b=u6ovtSRtVycnTzyBUaSYnVvFnWOwQEubYdn28cz2U8zzjc7ZZg+dLFv4MdTVE6H+ug KoS6QiO9pMGKdWMbKc7rO1uzPfx23+jjCJOXzevni94LciyebU7OKl/4qeN8YusTWi/h Ksr204GIjAL5TYpLTAb0IIH//l7ITXCEqewxMVbbZ7osmmEIDM5wWZfI+/RDHi5bNxW2 15hYfsx2Ck0AEnWf/fcfFaGun7bgCvQsT0uGu57uKlKGHQCpzYieRSPZqDX9PebwRqVO FgdgrgHof6rcddjfnDfdaseeMejXQ/KNKwgOPfu4s1q8MKOxdzXtU6KZ9mI5cdscFNIv S2kQ== 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=3LO0o4GRg1Mfk4ZicjdwfYHztVCB2uoxm6EOhsNIHqM=; b=S3dqD2aHBZZ2lyM8Hd5PEiXPEOZKYzIX8twNSgKb/006XJRW6x3jhJRY5GZ01LGuNU H/bogZ6J3Rz1On3/mkR05Fdmlrqsug7Azga5JP/66jljmgXGxBzDzO8aj14PWSkhQ+Wc YwA/lYmAEXDuFXhj1z4WsOinzD1eQZcKfhf9G6OyHjto3fcIc2B6Grxbz0qQCLVTB2YQ MJ3ynEVGl7TvnSnuKQA6gUXuP3eMvwgI0hCgQznpQEGfJcL33spZPRt+zYH6iJggEoa3 Z3iA+KLSDfUht77xu1s/WDs/r5IKZf0sG4XuZjFZd1SPD/h0GJPXLxQaqWC8IV2eChwn GdYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MRJ70Qcv; 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; 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 z3si12002080edx.85.2021.06.14.04.06.04; Mon, 14 Jun 2021 04:06:26 -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=@linuxfoundation.org header.s=korg header.b=MRJ70Qcv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235098AbhFNLEo (ORCPT + 99 others); Mon, 14 Jun 2021 07:04:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:59780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234731AbhFNKyR (ORCPT ); Mon, 14 Jun 2021 06:54:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9F619613FB; Mon, 14 Jun 2021 10:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667209; bh=RRh9Rbk+Z1e0LlT0TvpDul0SsHCyvMlCq7t2RGLhUnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRJ70QcvaNjPPqztmfv/BSbCEy1pe8cmlrfz1rBgPmJwHioLkYMcEDV+cLNX1JSYb 9XtoGMvJdtaqiyTwuA6lX5iOi7p6KrEb8ei4rFrygPB9JEqyQWkUC7cJTH8+eEa97K Aqex94azUvgAYqr7jURDUVDV1ZLZhvZzhSGajiqM= 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.4 69/84] sched/fair: Make sure to update tg contrib for blocked load Date: Mon, 14 Jun 2021 12:27:47 +0200 Message-Id: <20210614102648.710506045@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102646.341387537@linuxfoundation.org> References: <20210614102646.341387537@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -7660,7 +7660,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