From patchwork Tue Mar 22 00:21:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Muckle X-Patchwork-Id: 8636761 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5075B9F36E for ; Tue, 22 Mar 2016 00:21:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80AC92034C for ; Tue, 22 Mar 2016 00:21:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88E502035B for ; Tue, 22 Mar 2016 00:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758003AbcCVAVT (ORCPT ); Mon, 21 Mar 2016 20:21:19 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:33822 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751941AbcCVAVN (ORCPT ); Mon, 21 Mar 2016 20:21:13 -0400 Received: by mail-pf0-f169.google.com with SMTP id x3so284478535pfb.1 for ; Mon, 21 Mar 2016 17:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X9qv6xYB9tyxuiuw7y+E3gluHeN7qqURLPb2wRAAqwI=; b=TThwTz7DY2ttLBamMNbrDRDdZRP1U3b4dJY0yPi6UAVCdLnAehfEBPiXMOQlGY5y57 6oYKU9LRtPDm5apCy0fdc8mayuKZ3BFdms33gZ1LGBKtaZFakX/DSZtuDbtwPWFF5I0v F50qrVQTe4UmvatHHUcukN0b1A1mAOpKdprtQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X9qv6xYB9tyxuiuw7y+E3gluHeN7qqURLPb2wRAAqwI=; b=SO5jNRtV9QUYnML+wl6FDQpWRpkmwVN4wb99n5sYQyw4JXMzzK92WzlpB90WwEgp7t tIb1ju6S6qPrSEx3FXrJEOowMh+Zff6ubF3T0qeN4f+LL32Mm2REyMJ8DLsgi8jYiqfO U5HG2Vx8PtU/Qe6cpVG0FYOKhMK88g+lAwOlwmWjRyHo5w4/uRTihoxKzNSMQdY4J/k7 YT+oJi0SryYhX6u1j3vxQD+xEiB7i5l4Wmx+h1wtmLAaWfvrkvyOknrXsnGpID04UJbS SSp8AI2hwkNeCKaBTycfUxx82zOsoSpeRQcRlp7egteBX505AKMDjHX74vgK2S/c9OO+ ZBAQ== X-Gm-Message-State: AD7BkJIgJ+eHLZhNajJseRv8vR7ohEnRr2ymM+Blbf9BldStIMDJgTMn7OKAUMGOB+PYEFXq X-Received: by 10.98.67.67 with SMTP id q64mr49864238pfa.44.1458606073126; Mon, 21 Mar 2016 17:21:13 -0700 (PDT) Received: from sky.smuckle.net (cpe-75-80-155-7.san.res.rr.com. [75.80.155.7]) by smtp.gmail.com with ESMTPSA id 82sm43318418pfi.78.2016.03.21.17.21.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 21 Mar 2016 17:21:12 -0700 (PDT) From: Steve Muckle X-Google-Original-From: Steve Muckle To: Peter Zijlstra , Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Michael Turquette Subject: [PATCH 2/2] sched/fair: do not call cpufreq hook unless util changed Date: Mon, 21 Mar 2016 17:21:08 -0700 Message-Id: <1458606068-7476-2-git-send-email-smuckle@linaro.org> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1458606068-7476-1-git-send-email-smuckle@linaro.org> References: <1458606068-7476-1-git-send-email-smuckle@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's no reason to call the cpufreq hook if the root cfs_rq utilization has not been modified. Signed-off-by: Steve Muckle --- kernel/sched/fair.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d418deb04049..af58e826cffe 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2826,20 +2826,21 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) { struct sched_avg *sa = &cfs_rq->avg; struct rq *rq = rq_of(cfs_rq); - int decayed, removed = 0; + int decayed, removed_load = 0, removed_util = 0; int cpu = cpu_of(rq); if (atomic_long_read(&cfs_rq->removed_load_avg)) { s64 r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0); sa->load_avg = max_t(long, sa->load_avg - r, 0); sa->load_sum = max_t(s64, sa->load_sum - r * LOAD_AVG_MAX, 0); - removed = 1; + removed_load = 1; } if (atomic_long_read(&cfs_rq->removed_util_avg)) { long r = atomic_long_xchg(&cfs_rq->removed_util_avg, 0); sa->util_avg = max_t(long, sa->util_avg - r, 0); sa->util_sum = max_t(s32, sa->util_sum - r * LOAD_AVG_MAX, 0); + removed_util = 1; } decayed = __update_load_avg(now, cpu, sa, @@ -2850,7 +2851,8 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) cfs_rq->load_last_update_time_copy = sa->last_update_time; #endif - if (cpu == smp_processor_id() && &rq->cfs == cfs_rq) { + if (cpu == smp_processor_id() && &rq->cfs == cfs_rq && + (decayed || removed_util)) { unsigned long max = rq->cpu_capacity_orig; /* @@ -2873,7 +2875,7 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) min(sa->util_avg, max), max); } - return decayed || removed; + return decayed || removed_load; } /* Update task and its cfs_rq load average */