From patchwork Mon Jun 14 10:27:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 459810 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp2584377ejc; Mon, 14 Jun 2021 03:56:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxy/e6jaBJicOMI0/GgzjEOrs0Hl8udE/Dma/M00jp2BzkjkYQDCyVLEr2Q/q5BJ8Agxg1j X-Received: by 2002:a17:906:40ca:: with SMTP id a10mr14587907ejk.181.1623668169790; Mon, 14 Jun 2021 03:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623668169; cv=none; d=google.com; s=arc-20160816; b=P4ACLjrJYdHg4p+SGzlHm4329MBLx494KJoZmqgpg3PgQm/Tq5R4WzlaI2jQaA3la3 poyKM63qCUEhXtGP3hWlwrVNSwQB5/h/xuMRP5vqrYaEhxlEn+wtO/lr9TWjZaX0m96S 7W0ZmW0dk6N39V5qJUgeyfihls9AQOm4kM2CO6eBMOtkSwYs/sdYCdCnjh1ldIUE2i2e NZs1qhhAegivLcu5tXg38xNLIBduCVDJIh3xs3gM32icQ5PWY8pRQtaI4P46gzjiUH6T CGiiVFd7RGdBouhoENsfn9yp35Gq0vXTi3XKKZ+kU2Ue7MTyrwAiagtQ7ZjRlg8NUNxN fBog== 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=iypea8hst9dhq0aPCrSukIxNbQr5xjsxfJt5oCSzjVZTo3qY0vfekGpIaIbhmcQUf7 PA04Em4KJO3sW0/fGUERzKWw01yqtuSQ82/BUqylKssouRgXK4u2mnwMs8HUx14oaRgZ 4sDdHcDo08WtyJJYCbzcs5C6EzIjHYPN7HNX8C6Fl6AK6RzKcnXRDpxCMTPL4YeW4w08 1vJTRqpS224//0+RRAQ1G/X5n6roHSYCq6K9Gz776SO6klYaDDVlrAxVqS0OCwxAVpxS 4Ncrl5jfTCaQJPAE8u8qFDOtxfscrcQ33GM9o0bKOaK9JEmM+Aoj1H1StJYV5npyMzDT VKcw== 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 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 cb22si11685300edb.401.2021.06.14.03.56.09; Mon, 14 Jun 2021 03:56:09 -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=MRJ70Qcv; 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 S233890AbhFNK53 (ORCPT + 12 others); Mon, 14 Jun 2021 06:57:29 -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 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 @@ -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