From patchwork Wed Dec 11 15:05:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 181230 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp903484och; Wed, 11 Dec 2019 07:12:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyVfSf4Y8VQCFHeAMLwUNtmoxZIKHzhzs40ZVRTwbkY15CXaharAX/1Gze2jL6x1nE1UOiz X-Received: by 2002:a9d:74c7:: with SMTP id a7mr2705307otl.7.1576077154090; Wed, 11 Dec 2019 07:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077154; cv=none; d=google.com; s=arc-20160816; b=XHzjxQ3Gt5I/vac22U0A2VsYO6FOuEugBxCMph4egO0ArL4hnnWoUL84C8s4tv1ipH BHdfsFtUaSlFRgC9KqLlTB6I5utiDXMlksd6CoU3E3atomQsXehOjC9TW92yCnGf45X6 JE2iXsSvaSZ3YsUrQ+dQfHvsrLMD8+asvTzeyJoP2HvYyH933dr2oqVCYD+2eS1Nkyp4 a6cmGrmryBcSKMqY6SbwyMM2EFYRDHC++Dhl3xTkc3C2Ast3IkGvSR506GVdEsqdzK3K ZZx084Zg7OLW0GQEIxyVA3eniJDh7A4UiZGgufrAoTbA0ag9MImoXGOIxFykeX4scipq U/Cw== 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 a127si1314842oif.81.2019.12.11.07.12.33; Wed, 11 Dec 2019 07:12:34 -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 S1731170AbfLKPMc (ORCPT + 27 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 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(-) -- 2.20.1 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); }