From patchwork Mon Jun 14 10:27:56 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: 459820 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3180038jae; Mon, 14 Jun 2021 04:09:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9QGR6o45KTBwNYz0/KpXYJXMwdT8ibBApoXAHXrO7U0j58HhJcjq69YRr48K5EsFD2fNr X-Received: by 2002:a17:907:1689:: with SMTP id hc9mr14724529ejc.552.1623668994563; Mon, 14 Jun 2021 04:09:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623668994; cv=none; d=google.com; s=arc-20160816; b=DzEP5TXyiKCyLf3Q+n8atwwR1kTugY6iAmASgQIKfETqmr3QmzIJWoXb3Z7J2VhMjk xwWsKECub8GT1UbPemt4wU9UR2NLUEc3tzhq9o1E9WaCUsxALxcIvmcRDBux+H3jcVU4 hAEfHW2Uf459gdyJAdY5kCnIhHHJi/TiQWfqVZ4Ik9QakriMBlTXuAREYSeQ612N2w+1 DB2LtZElm/5bd6F3RaGjv4qQMwuFc6wCMteFsAswPk3kZi6q71dA4vsVCb7539IlOXPY 0zU7YIt/a048b7p+ObD6VhVEYXGM7Tx05/G0p/onjWIAvn1tLEoP/YHIPl7a4L4ezU70 ccAg== 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=ligaoLVSuV97R69VzoJJXOjgh40UgO3ibdIKxkTQhMY=; b=i9UpkvR5bToBEr28bzbNBxFlPdIiMw8p7XgqxOET439QfSDt+hLNo6xlSvsZwJJhsM 3ZefSmxHmTcKpdl/NSb/FXVwVyowV0sSIpXknMbitjZ7Yf1hleDLaJaZO5PXACW8Hg/D 7j1Vb9/DunF+ym/yw+qz9ciLLrVWsWUQYQnYz3n3ikjGKeWiL1bvi78FeBPtED1PQ0DC GtV8h6GB8pBHOKcZlfQgdb0dfAXNCgOJD27sda1zJZpaGYJ8LSllpJDDoYOpZLUb1Uk8 OV7OVU+12JIQVUiXl+GrAybI0dzM2mr0dwfNpk0/DFnCf+xGRu6+1TFDo+Byjr6Z73Um mwZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lasZa5fF; 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 y4si574263edc.212.2021.06.14.04.09.54; Mon, 14 Jun 2021 04:09:54 -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=lasZa5fF; 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 S234718AbhFNLLz (ORCPT + 12 others); Mon, 14 Jun 2021 07:11:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:42798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235182AbhFNLJR (ORCPT ); Mon, 14 Jun 2021 07:09:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBB9B61451; Mon, 14 Jun 2021 10:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667599; bh=HmGtk6wuKZAXH34pl1mKpHWctvshAXn+rd+v+AcQs48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lasZa5fFtdO0EyNqejtiWdfI2zxv38csHVc0bDz66DnIEAyCEn8RDCwRylWuBh4FS w8nnfmBlXlKmGfpZpU1vasCZPgBbfDsINY+P23F0peKFBrShMBLqtlc9ab6S7oTI+m gLDIVqxs6kKMtJhUhqzFEdnXFp7aQIlZENcPnQfc= 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.10 115/131] sched/fair: Make sure to update tg contrib for blocked load Date: Mon, 14 Jun 2021 12:27:56 +0200 Message-Id: <20210614102656.928017018@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@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 @@ -7960,7 +7960,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