From patchwork Mon Dec 4 10:23:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juri Lelli X-Patchwork-Id: 10089951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8715F60329 for ; Mon, 4 Dec 2017 10:26:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D44D28C08 for ; Mon, 4 Dec 2017 10:26:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6215428C0F; Mon, 4 Dec 2017 10:26:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, URIBL_DBL_ABUSE_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D738F28C08 for ; Mon, 4 Dec 2017 10:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753960AbdLDK0j (ORCPT ); Mon, 4 Dec 2017 05:26:39 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:40130 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753551AbdLDKYK (ORCPT ); Mon, 4 Dec 2017 05:24:10 -0500 Received: by mail-wr0-f194.google.com with SMTP id q9so16627385wre.7 for ; Mon, 04 Dec 2017 02:24:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ok1IoNWsSc5SPbW7Qs1gsW6XD9UfS7OPuFMYCjsLEcU=; b=OwGFfg3LnUIV81TZZzZUp+fyMI9pRokZBXfalFGP39IcLtS29uucVPe1vRbKKAlSCt EUk5BIUvKuTx1BaGSVKcREY85h19WCvBv4GtCh/LWPFSqB3efJ+2f8mmDcdI5tNoweUC eG6M9K6jPOc+g8n315gKYUDDf2CxKTPN0lAbnzNAnAb46EwgdgrMDSvF0ip8hFeuhoI5 sbuH31Wsz6Y57RhTr5d1E6FFjWCg3ltDiQfKG5ZBAth+ZEQQcJhJs9E/xBPN4kkhrs29 gX4Qha2nVC1fvHcaCZnLmAQJqnS7aKUCu+ZXqWqg21xRQWeoRQQ0R3prA3uafJgqftmr xhqg== X-Gm-Message-State: AJaThX67PMfJSH+X++DKvkP4IwJUzPjet0JwnBZtWWwyhh+xf3JfSgFt 1DAAjncfvfMX0Ns/vBosu4wyBA== X-Google-Smtp-Source: AGs4zMbIITGFXzfQUtD+7lPb2wKEoXwNc5DI2GBB83ETXwMefu76+zaU9nAa4G626hlBIgwNrMp30Q== X-Received: by 10.223.133.250 with SMTP id 55mr13144423wru.23.1512383048157; Mon, 04 Dec 2017 02:24:08 -0800 (PST) Received: from localhost.localdomain.com ([151.68.92.1]) by smtp.gmail.com with ESMTPSA id y2sm13542473wra.18.2017.12.04.02.24.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Dec 2017 02:24:07 -0800 (PST) From: Juri Lelli To: peterz@infradead.org, mingo@redhat.com, rjw@rjwysocki.net, viresh.kumar@linaro.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, tglx@linutronix.de, vincent.guittot@linaro.org, rostedt@goodmis.org, luca.abeni@santannapisa.it, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, bristot@redhat.com, mathieu.poirier@linaro.org, tkjos@android.com, joelaf@google.com, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, patrick.bellasi@arm.com, alessio.balsini@arm.com, juri.lelli@redhat.com, Juri Lelli , Ingo Molnar , "Rafael J . Wysocki" Subject: [RFC PATCH v2 2/8] sched/deadline: move cpu frequency selection triggering points Date: Mon, 4 Dec 2017 11:23:19 +0100 Message-Id: <20171204102325.5110-3-juri.lelli@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171204102325.5110-1-juri.lelli@redhat.com> References: <20171204102325.5110-1-juri.lelli@redhat.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Juri Lelli Since SCHED_DEADLINE doesn't track utilization signal (but reserves a fraction of CPU bandwidth to tasks admitted to the system), there is no point in evaluating frequency changes during each tick event. Move frequency selection triggering points to where running_bw changes. Co-authored-by: Claudio Scordino Signed-off-by: Juri Lelli Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Rafael J. Wysocki Cc: Viresh Kumar Cc: Luca Abeni Reviewed-by: Viresh Kumar --- kernel/sched/deadline.c | 7 ++++--- kernel/sched/sched.h | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 2473736c7616..7e4038bf9954 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -86,6 +86,8 @@ void add_running_bw(u64 dl_bw, struct dl_rq *dl_rq) dl_rq->running_bw += dl_bw; SCHED_WARN_ON(dl_rq->running_bw < old); /* overflow */ SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw); + /* kick cpufreq (see the comment in kernel/sched/sched.h). */ + cpufreq_update_util(rq_of_dl_rq(dl_rq), SCHED_CPUFREQ_DL); } static inline @@ -98,6 +100,8 @@ void sub_running_bw(u64 dl_bw, struct dl_rq *dl_rq) SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */ if (dl_rq->running_bw > old) dl_rq->running_bw = 0; + /* kick cpufreq (see the comment in kernel/sched/sched.h). */ + cpufreq_update_util(rq_of_dl_rq(dl_rq), SCHED_CPUFREQ_DL); } static inline @@ -1134,9 +1138,6 @@ static void update_curr_dl(struct rq *rq) return; } - /* kick cpufreq (see the comment in kernel/sched/sched.h). */ - cpufreq_update_util(rq, SCHED_CPUFREQ_DL); - schedstat_set(curr->se.statistics.exec_max, max(curr->se.statistics.exec_max, delta_exec)); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index b19552a212de..a1730e39cbc6 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2096,14 +2096,14 @@ DECLARE_PER_CPU(struct update_util_data *, cpufreq_update_util_data); * The way cpufreq is currently arranged requires it to evaluate the CPU * performance state (frequency/voltage) on a regular basis to prevent it from * being stuck in a completely inadequate performance level for too long. - * That is not guaranteed to happen if the updates are only triggered from CFS, - * though, because they may not be coming in if RT or deadline tasks are active - * all the time (or there are RT and DL tasks only). + * That is not guaranteed to happen if the updates are only triggered from CFS + * and DL, though, because they may not be coming in if only RT tasks are + * active all the time (or there are RT tasks only). * - * As a workaround for that issue, this function is called by the RT and DL - * sched classes to trigger extra cpufreq updates to prevent it from stalling, + * As a workaround for that issue, this function is called periodically by the + * RT sched class to trigger extra cpufreq updates to prevent it from stalling, * but that really is a band-aid. Going forward it should be replaced with - * solutions targeted more specifically at RT and DL tasks. + * solutions targeted more specifically at RT tasks. */ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) {