Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5416435yba; Wed, 8 May 2019 13:00:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzrIjIz1gXVDA65i46SpIk14w90EFFlTkvfsgjDL0nFvFk1KP+uQD8U7tpayzbPxYmkAKgN X-Received: by 2002:a65:6554:: with SMTP id a20mr50453505pgw.284.1557345650781; Wed, 08 May 2019 13:00:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557345650; cv=none; d=google.com; s=arc-20160816; b=ygch43KG5CjU7v6P4qFrHvCuvGc9bg9uiN5Zsqws12pKJgnIc1HQwqOSGONc63MmzM KeHPAALYKE8rxsoShmZJL79INnu3rNiCcvHcux4hyVA0JKiBK39qCvp98uQkLdmu4Zki ekmcuu3nb9dSC33+EDEAp+ye1LgAqcg0rC8Z231mtwBQUDXOINYyLmv/8QYQRnLFI/wQ xKGHhReSB/yf2LTx5QbxB6ug5zZI5Ye74dFAK5Iux7fZ1NIZpyVUuod9u+EtHsYqDWqt 5J41f1yr2SAZke1V8/u/B98bVEEORtJlf1O07riy9Akj9mAju2/iyRr7L5eIWSy4Wnoo Jx+g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8dQZk8FglERpgKmtn4qi0ERnVetss7c9PH/W2RRJHug=; b=mmmhgRLwBSMafzDHPXIUKXxk4ag22Y6tcIviCEZO2I6PvNJoTuQNPMEiudia0Pw/nD 4HRFfI8X4LrwOUks5vUZLzYtmB0YX3IRBmROTYsjitqQP6xemcAgN5SwT9OXysf1ckIE MkgOv3QjtVFeZTQBiMZphquxDzCaRRMV2WRxPDw0rd+Bl4s4zOYG7Qry6uNrPYrP+Nu+ xvwgEdKLDbw2TvB07j4eX8l3D1QRHS0A8Bxq34vW/6tdsb7r6ex/tM9Be9FlfhwirT/z W/Wp6llGb2ox+9htZC6YR7sHavsEZ+6Xew1TjDj+NWgqgyiqoZEFbZKwDPrrmkcLQ3NX uF/Q== ARC-Authentication-Results: i=1; mx.google.com; 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 24si17144694pgt.474.2019.05.08.13.00.26; Wed, 08 May 2019 13:00:50 -0700 (PDT) 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; 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 S1729106AbfEHRnT (ORCPT + 99 others); Wed, 8 May 2019 13:43:19 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41828 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725910AbfEHRnR (ORCPT ); Wed, 8 May 2019 13:43:17 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1476CA78; Wed, 8 May 2019 10:43:17 -0700 (PDT) Received: from e107049-lin.arm.com (e107049-lin.cambridge.arm.com [10.1.195.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8EBFD3F575; Wed, 8 May 2019 10:43:15 -0700 (PDT) From: douglas.raillard@arm.com To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, quentin.perret@arm.com, douglas.raillard@arm.com, patrick.bellasi@arm.com, dietmar.eggemann@arm.com Subject: [RFC PATCH 5/7] sched/cpufreq: sugov_cpu_is_busy for shared policy Date: Wed, 8 May 2019 18:42:59 +0100 Message-Id: <20190508174301.4828-6-douglas.raillard@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190508174301.4828-1-douglas.raillard@arm.com> References: <20190508174301.4828-1-douglas.raillard@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas RAILLARD Allow using sugov_cpu_is_busy() from sugov_update_shared(). This means that the heuristic needs to return stable results across multiple calls for a given CPU, even if there has been no utilization change since last call. sugov_cpu_is_busy() currently both checks business status and updates the counters, so let's decouple the two actions. Signed-off-by: Douglas RAILLARD --- kernel/sched/cpufreq_schedutil.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index a52c66559321..a12b7e5bc028 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -178,12 +178,17 @@ static bool sugov_cpu_is_busy(struct sugov_cpu *sg_cpu) { unsigned long idle_calls = tick_nohz_get_idle_calls_cpu(sg_cpu->cpu); bool ret = idle_calls == sg_cpu->saved_idle_calls; + return ret; +} +static void sugov_cpu_is_busy_update(struct sugov_cpu *sg_cpu) +{ + unsigned long idle_calls = tick_nohz_get_idle_calls_cpu(sg_cpu->cpu); sg_cpu->saved_idle_calls = idle_calls; - return ret; } #else static inline bool sugov_cpu_is_busy(struct sugov_cpu *sg_cpu) { return false; } +static void sugov_cpu_is_busy_update(struct sugov_cpu *sg_cpu) {} #endif /* CONFIG_NO_HZ_COMMON */ /** @@ -503,6 +508,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, return; busy = sugov_cpu_is_busy(sg_cpu); + sugov_cpu_is_busy_update(sg_cpu); util = sugov_get_util(sg_cpu); max = sg_cpu->max; -- 2.21.0