Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp829717ybl; Wed, 11 Dec 2019 08:08:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxh7Cr4AhGb7/M+AN8N0ftyjiohMzE2yZiXXxnyUts2C32gQz+yD+Kpb+xYHL9dVWiMT4kf X-Received: by 2002:aca:4dd3:: with SMTP id a202mr3467491oib.3.1576080502963; Wed, 11 Dec 2019 08:08:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080502; cv=none; d=google.com; s=arc-20160816; b=0euJoIiw9G4nqlbI7GEcjAWZfQkXVCCF7fqPTT9ptZ1Wt1yA9J60V0vG0NMVoCq+Vw dk2Fks2OgNZgyNo2pEB8BCYMYJL1mMn0AiUuecx4s3Fiwmn/jVBOHMCjUxf0DmeWeSsV lzcgZWqlbpy8jPD8irFi9WC6Jm3lrO1lbzKsQEnCgpIYNPnP01Qyw62YKS2mx3rf/6jq nx7u4bD3IMT5zo+zX2OOz/JUcSZxO/W/4C8QOW8gV/nqt8ts+Jb/4Y3VDQINUag9d7SY 6bA+sYlfp8RICrlVhA5N7Ebt5bMDPFG7HPkNtg+cIdmMmJ5WxzkznXh6zFkWuWhu3HsN Mycw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yKiLlalyiYJuX0VuOkvU/CMGm/JBbRHRUKdry9rOx84=; b=i+QUmKnllTrNdBTcKepxr/dF/U4YO62+5JiUtIZDnPCA+/6rdGmvAjmqazY+KqfE9f UOSn1B0Wt5VAhIOQB19IbCIBlLW1ikUPXV4Pv+mfOyZEEzOk0hxWSnefl41n1OMHf3Fs 3CgdozM/gUFvhPCpR3CfJQYuI7aeQ6wHaXpfKy2EytKmBoJ/bmtZJCBNJY/GZ388nuAZ vPS+nLo6YBW+2NKLRFqnwcflOOvq1sYvWbTjuaUljNFrBXNYq3TZu5wtXw1QhRugezMt 431+tlpM7S7YoKAaibwOP5kSDam0KTqUH1hw4t1B9aDTJ41UwWBoqeoCjcaK8UbltXZL knJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2b0Q2Nu5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si1288875otq.112.2019.12.11.08.08.10; Wed, 11 Dec 2019 08:08:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2b0Q2Nu5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731166AbfLKPMc (ORCPT + 99 others); Wed, 11 Dec 2019 10:12:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:33634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731083AbfLKPMS (ORCPT ); Wed, 11 Dec 2019 10:12:18 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8F5DD2465B; Wed, 11 Dec 2019 15:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077137; bh=zQiU5dKwHOVRXTN0rVnNamHfzml94EObSwNzq6VHy0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2b0Q2Nu52JuT65VBZPg33Y7Sx7jY9EENYN4Xcs3d7aJqS4uJrrBJ62Xf/aLhOzd4e PtYShHhLtEiW3cXP4tVODnSNi4kKcM13ZfeVa20O/oUvnhwoudM+gc6dDsLgMvZixd g0DZFcj8hmIuTtncqm9KU7ZpBtozBzFBGnsHWNQ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Guittot , "Peter Zijlstra (Intel)" , Linus Torvalds , Thomas Gleixner , dietmar.eggemann@arm.com, dsmythies@telus.net, juri.lelli@redhat.com, mgorman@suse.de, rostedt@goodmis.org, Ingo Molnar , Sasha Levin Subject: [PATCH 5.3 030/105] sched/pelt: Fix update of blocked PELT ordering Date: Wed, 11 Dec 2019 16:05:19 +0100 Message-Id: <20191211150230.499055068@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Guittot [ Upstream commit b90f7c9d2198d789709390280a43e0a46345682b ] update_cfs_rq_load_avg() can call cpufreq_update_util() to trigger an update of the frequency. Make sure that RT, DL and IRQ PELT signals have been updated before calling cpufreq. Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: dietmar.eggemann@arm.com Cc: dsmythies@telus.net Cc: juri.lelli@redhat.com Cc: mgorman@suse.de Cc: rostedt@goodmis.org Fixes: 371bf4273269 ("sched/rt: Add rt_rq utilization tracking") Fixes: 3727e0e16340 ("sched/dl: Add dl_rq utilization tracking") Fixes: 91c27493e78d ("sched/irq: Add IRQ utilization tracking") Link: https://lkml.kernel.org/r/1572434309-32512-1-git-send-email-vincent.guittot@linaro.org Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/sched/fair.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 649c6b60929e2..ba7cc68a39935 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7530,6 +7530,19 @@ static void update_blocked_averages(int cpu) rq_lock_irqsave(rq, &rf); update_rq_clock(rq); + /* + * update_cfs_rq_load_avg() can call cpufreq_update_util(). Make sure + * that RT, DL and IRQ signals have been updated before updating CFS. + */ + curr_class = rq->curr->sched_class; + update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class); + update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class); + update_irq_load_avg(rq, 0); + + /* Don't need periodic decay once load/util_avg are null */ + if (others_have_blocked(rq)) + done = false; + /* * Iterates the task_group tree in a bottom up fashion, see * list_add_leaf_cfs_rq() for details. @@ -7557,14 +7570,6 @@ static void update_blocked_averages(int cpu) done = false; } - curr_class = rq->curr->sched_class; - update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class); - update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class); - update_irq_load_avg(rq, 0); - /* Don't need periodic decay once load/util_avg are null */ - if (others_have_blocked(rq)) - done = false; - update_blocked_load_status(rq, !done); rq_unlock_irqrestore(rq, &rf); } @@ -7625,12 +7630,18 @@ static inline void update_blocked_averages(int cpu) rq_lock_irqsave(rq, &rf); update_rq_clock(rq); - update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq); + /* + * update_cfs_rq_load_avg() can call cpufreq_update_util(). Make sure + * that RT, DL and IRQ signals have been updated before updating CFS. + */ curr_class = rq->curr->sched_class; update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class); update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class); update_irq_load_avg(rq, 0); + + update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq); + update_blocked_load_status(rq, cfs_rq_has_blocked(cfs_rq) || others_have_blocked(rq)); rq_unlock_irqrestore(rq, &rf); } -- 2.20.1