Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2664582pxj; Mon, 14 Jun 2021 04:23:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6WH/XVh/w+NQl/mfWcgEe+IyK11+U3HouP3cS1n8T4bvEVx4I+uuJaBA1DXno5wODbdFs X-Received: by 2002:a17:906:ecbc:: with SMTP id qh28mr14218582ejb.406.1623669814130; Mon, 14 Jun 2021 04:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669814; cv=none; d=google.com; s=arc-20160816; b=GNAi60MaC4TI7uEDiApTiNHXhVn6gqfAFvmw9L3mQyxn6Pp1eoFgGH95jl093QeIRD Y8EnLEz0TyQg3UDI1YFa9DvUtSlLOJ0SPaH2COL4ZjBHN+wX6AMODgYdHjuUI+y5S3V4 rJr59u3+SbKX7r8dpOekPAhyQ8lWfjOrFo0JcSWqUGpbJXddB+s31TIOzk+uF5GUcFOj y/t9334SeN2goddR0yxzcqHOK6fPEUhpHD83OGemg6sXjjic0nfUIlpWeOjYhK/VHn00 pJV3QKa5HGhPctBSZeMFPi4vT53EfFH9jhHVl1R6pXAXDNCXombvOtxr8YkU++RNB27n MRbA== 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=Fl5/FAOmCNVr+wVFv4TowOIX7NF9J5CkhfDbaL5L9tda18Xlxf3ezH7NVfnwWJS7nx ONhGLEMCIsc9t89aDpUwPZDyi5Cs10W91hLxQwUtNqLuukDMLB0hR3Jb86Mixgj/EiVL ms0pONYH+eGoyCGL1RJ5zQaqzFIlsj6AQ72nqn3G0Hn2s8VwwUPC8ge+b8GY3GiMLChC vrMK0o6hjMa8v+Ix51cXdoD2pXtYH5aeRN+QMMi72eGINAn6+cJO+ABMQoTtyaTtqhmf RgIJ4z5GrRznwpiEqj0fkbbs7SIEqMc4VqBtYQklWNz4P1uNF1qZuVMX+Fg/uaTh8mbG J+oA== 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 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 d12si10823423edq.386.2021.06.14.04.23.11; Mon, 14 Jun 2021 04:23:34 -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=lasZa5fF; 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 S235141AbhFNLVW (ORCPT + 99 others); Mon, 14 Jun 2021 07:21:22 -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 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 @@ -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