From patchwork Mon Jun 14 10:27:55 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: 459822 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3181496jae; Mon, 14 Jun 2021 04:11:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTkCuOkbsYzazjm2QEFQUzxNRD+cjXzDsywHKHVh6W32ItpJK2gIcyOfU88glZgtygqfnV X-Received: by 2002:a17:906:318b:: with SMTP id 11mr14515877ejy.395.1623668994985; 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=H9nlyPK6f+Mc4AudFzN5yEKVuc2kiz1TkvGUQAgtxDq3rf+yqCSy+GfwdqNWTzSo01 5dqCVumRuVQAmtt4a8X/gE9dmFA5nZqR6Yw7C8fH1Cn8CZy8ENcloh9mrK87ZnOzjSOR 0BbqDWZO7ImAmKLe7dMBmsc3MKvORQdJIq0WSsEc9rp/I/RB1ViXtrAi8hCfL0bjGIIp kH8LmqynnNY0zWjk/n+tDg+zAMRCURFi2Sqw7nmdoHfUsvKx7Hr2VDSfLyigBazFC/MG rL31bJnwK20LdMVQqt/3YUyvgiTwLf3AmC17EuP3+zg72cOwjOC6qSPJ4NMhLXio7eoW yevA== 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=IiBd9UpNjKug2EdTTrIFfgYhYDzPLU5eF1roM+yBdPA=; b=RGKFM8YsrHNEGF6kNn0iAEWwyxTwyyRhMrmDdpKYLYBvhujaru04kEXGgvz0Ghuv9d ZiltO5lIX3ElRBudGn07Zib0gB0vn9uSvaNG8Ou5K0bC/gfUI/DwC66xDEOBXXB/J2WY lgdUTJvQUxWNNT+MtbsYGfG5CeBwVc5pzcGEjadUbW2C6d4/sIJIKN+vQUmNCppR0/JF B47LJiV2cRpKMMJZkziQkbcd3pt+/Q9sv8AdRpkioYpFLw4IZBFz9VSfWp068knB5pfM ASk2Ev9YHyPZvkdMHxMRJVO8ZmYcvqBNn5MDvYM0o71yM03ewrvyN85XkpqnlTMO/H+D +gYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ycOaV6ga; 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=ycOaV6ga; 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 S234219AbhFNLL4 (ORCPT + 12 others); Mon, 14 Jun 2021 07:11:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:39876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235180AbhFNLJR (ORCPT ); Mon, 14 Jun 2021 07:09:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7A47F61934; Mon, 14 Jun 2021 10:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667596; bh=nu+nOGoMoJeQ4qAVP6L4bIpjHxDHoW5h7IIKNTJNzmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ycOaV6gaWbEQ4fz6f9g2DHkD9nHLYGRanFS2gfPt+1Y6WPm/JBqSchB5MHDakg6G5 K/QvOBXxsEVm+f4vQpikrqgz3Gw0uLiUp07tneaxazyt9G+RbvhEyE1YcjO4o6uRyK o3b4JI+ldrAEd9/d76QgnvaIAUH/YOVi79fQQ+bM= 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 114/131] sched/fair: Keep load_avg and load_sum synced Date: Mon, 14 Jun 2021 12:27:55 +0200 Message-Id: <20210614102656.896703672@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 7c7ad626d9a0ff0a36c1e2a3cfbbc6a13828d5eb upstream. when removing a cfs_rq from the list we only check _sum value so we must ensure that _avg and _sum stay synced so load_sum can't be null whereas load_avg is not after propagating load in the cgroup hierarchy. Use load_avg to compute load_sum similarly to what is done for util_sum and runnable_sum. Fixes: 0e2d2aaaae52 ("sched/fair: Rewrite PELT migration propagation") 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-2-vincent.guittot@linaro.org Signed-off-by: Greg Kroah-Hartman --- kernel/sched/fair.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3501,10 +3501,9 @@ update_tg_cfs_runnable(struct cfs_rq *cf static inline void update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) { - long delta_avg, running_sum, runnable_sum = gcfs_rq->prop_runnable_sum; + long delta, running_sum, runnable_sum = gcfs_rq->prop_runnable_sum; unsigned long load_avg; u64 load_sum = 0; - s64 delta_sum; u32 divider; if (!runnable_sum) @@ -3551,13 +3550,13 @@ update_tg_cfs_load(struct cfs_rq *cfs_rq load_sum = (s64)se_weight(se) * runnable_sum; load_avg = div_s64(load_sum, divider); - delta_sum = load_sum - (s64)se_weight(se) * se->avg.load_sum; - delta_avg = load_avg - se->avg.load_avg; + delta = load_avg - se->avg.load_avg; se->avg.load_sum = runnable_sum; se->avg.load_avg = load_avg; - add_positive(&cfs_rq->avg.load_avg, delta_avg); - add_positive(&cfs_rq->avg.load_sum, delta_sum); + + add_positive(&cfs_rq->avg.load_avg, delta); + cfs_rq->avg.load_sum = cfs_rq->avg.load_avg * divider; } static inline void add_tg_cfs_propagate(struct cfs_rq *cfs_rq, long runnable_sum)